KDAB · @kdab
193 followers · 147 posts · Server techhub.social

C++23 will be officially released later this year but is already complete. Explore how the latest C++ standard helps write modern, efficient, robust, & future-proof code with Giuseppe D'Angelo at the KDAB Training Day on November 27th.

馃敆 youtu.be/ZakKAQiEBRs

#cpp #cplusplus

Last updated 1 year ago

Andreas Fertig · @andreasfertig
250 followers · 74 posts · Server mas.to

I received the Best Speaker Award from ESE Kongress for my talk C++ 20 Templates - Die na虉chste Generation.

andreasfertig.blog/2023/09/bes

#AwardWinning #cpp20 #cpp #cplusplus

Last updated 1 year ago

Shafik Yaghmour · @shafik
354 followers · 287 posts · Server hachyderm.io

#239 Given the following in C++:

constexpr const char *x = "Hello World";
constexpr const char *y = "Hello World";
constexpr bool b = x == y;

Without checking, is this well-formed?

A. Yes
B. No
C. Show results


#cplusplus #cpppolls

Last updated 1 year ago

sigcpp · @sigcpp
41 followers · 79 posts · Server hachyderm.io

Constants can sometimes help find (certain) errors at compile time instead of runtime: constexpr over const variables; const variables over non-const variables; and macros or literals if you must.

Obviously, constants don't always provide this benefit, but strive to use them where opportunity permits.

Example: sigcpp.godbolt.org/z/sjd5vWrPn

(Also, avoid "naked new", but that's for another time.)

#cpp #cplusplus #programming #software #softwarequality

Last updated 1 year ago

KDAB · @kdab
193 followers · 145 posts · Server techhub.social

Follow our YouTube channel for weekly uploads covering a vast diversity of topics as well as a monthly news edition and recordings of talks from our events.

馃敆 youtube.com/@KDABtv

#qtdev #qml #cpp #cplusplus #embedded #rustlang #3d

Last updated 1 year ago

Andreas Fertig · @andreasfertig
250 followers · 74 posts · Server mas.to

I will be speaking at NDC TechTown 2023! The talk's title is "C++ Coroutines from scratch". Come and join me there!

ndctechtown.com/agenda/c-corou

#cplusplus #cpp20 #cpp

Last updated 1 year ago

艩imon T贸th · @simontoth
268 followers · 795 posts · Server hachyderm.io

The std::queue is a container adapter that implements the interface of a FIFO queue.

The options for the backing containers are std::deque and std::list.

Compiler Explorer link: compiler-explorer.com/z/5Gbo53

#cpp #cplusplus #coding #programming #dailybiteofcpp

Last updated 1 year ago

Dani (:cxx: modules addict) · @DanielaKEngert
316 followers · 1010 posts · Server hachyderm.io

connoisseurs, may I ask you for a favour and vote for this bug report on DevCom if you happen to care about ?

developercommunity.visualstudi

#cpp #modules #cplusplus

Last updated 1 year ago

Alessandro · @alephoto85
273 followers · 1214 posts · Server livellosegreto.it

[Certificazioni] Python Institute

@programmazione

Ieri su /c/informatica si parlava di universit脿 e certificazioni cos矛 ne approfitto per condividere questo link. Sul sito si trovano i corsi gratuiti utili a preparare il percorso di Python, C/C++, JavaScript e persino un corso di Inglese per IT.
Oltre a essere gratuiti ho letto in rete che, al completamento, viene offerto un voucher sconto per gli esami di certificazione.

edube.org/

#programmazione #python #cplusplus

Last updated 1 year ago

Sean Murthy · @smurthys
237 followers · 3075 posts · Server hachyderm.io

An illustration, a couple of exercises, and an example comparing references in C++ and Java (and Python). 鈽濓笍

(This is also when I wish more students were on Mastodon/Fediverse. I don't know but we need to collectively work on that.)

#cpp #cplusplus #java #python #programming #education #teaching #learning #student #students

Last updated 1 year ago

Sean Murthy · @smurthys
237 followers · 3074 posts · Server hachyderm.io

Selected slides from my presentation comparing references in C++ and Java.

#cpp #cplusplus #java #programming #education #teaching #learning

Last updated 1 year ago

Sean Murthy · @smurthys
237 followers · 3070 posts · Server hachyderm.io

In retrospect, how I wish C++ used the term "alias" instead of "reference" to be very clear that a pointer or similar underlying mechanism, including storage" is not necessary.

"It is unspecified whether or not a reference requires storage."

eel.is/c++draft/dcl.ref#4

The issue now (and not really C++'s fault) is that people coming from a language like Java hear "reference" and think it works the same way in C++ as it does in Java. Especially reference parameters. 馃様

#cpp #cplusplus #programming

Last updated 1 year ago

艩imon T贸th · @simontoth
268 followers · 793 posts · Server hachyderm.io

If we want to iterate over the elements of a bidirectional range in reverse order, we do not have to mutate it.

However, if we do want to mutate the range, we can use the std::reverse algorithm.

Note that std::list and std::forward_list provide a reverse method that reorders the nodes (instead of reversing the order of the values).

Compiler Explorer link: compiler-explorer.com/z/PEvznc

#cpp #cplusplus #coding #programming #dailybiteofcpp

Last updated 1 year ago

Andreas Fertig · @andreasfertig
250 followers · 66 posts · Server mas.to

Check out my post, "A string class that is only instantiable at compile-time", you learn how to have a class that s only instantiable at compile-time.

andreasfertig.blog/2023/01/a-s

#cpp20 #cpp #cpp17 #cplusplus

Last updated 1 year ago

Do you think it's worth spending time studying the C programming language today, considering that addresses and improves upon many of the fundamental issues found in and ?? Why?

#rust #c #cplusplus

Last updated 1 year ago

艩imon T贸th · @simontoth
268 followers · 792 posts · Server hachyderm.io

Despite recent developments (<format> and <print>), iostreams will be with us for the foreseeable future.

One of the quirks of iostreams is their approach to error handling, with errors represented using flags and error states.

Compiler Explorer link: compiler-explorer.com/z/eh5noa

#cpp #cplusplus #coding #programming #dailybiteofcpp

Last updated 1 year ago

Gareth Lloyd (He/him) · @glloyd
89 followers · 398 posts · Server fosstodon.org

I'm proud of my changes today. Fixing some small issues. Now a simple query just got ~80% faster.

Not bad for a +23 -13 change github.com/memgraph/memgraph/p

#memgraph #cpp #cplusplus

Last updated 1 year ago

艩imon T贸th · @simontoth
267 followers · 789 posts · Server hachyderm.io

Before C++20, using common mathematical constants relied on either POSIX or a compiler extension through the <math.h> header.

C++20 introduced a new <numbers> header that provides common mathematical constants as templates that can be specialized for user types. The standard library provides float, double and long double specialisations with an alias for the double variant.

Compiler Explorer link: compiler-explorer.com/z/9rd5ne

#cpp #cplusplus #coding #programming #dailybiteofcpp

Last updated 1 year ago

艩imon T贸th · @simontoth
267 followers · 788 posts · Server hachyderm.io

Tuesday common C++ interview problem: Calculate h-index.

Given information about research paper citations as std::vector<int>, where each element represents the number of citations for a paper, calculate the h-index: en.wikipedia.org/wiki/H-index.

Your solution should run in O(n).

Solve it yourself: compiler-explorer.com/z/5K5Wv1
Solution: compiler-explorer.com/z/9efEYc

#cpp #cplusplus #coding #programming #dailybiteofcpp

Last updated 1 year ago

Jakub Neruda · @jakub_neruda
187 followers · 586 posts · Server techhub.social

Tip 21 of - Dangers of Enums

C++ and C# have a caveat in their enum types. Each enum has an underlying storage type which limits a maximum number of values and how much space it takes in memory. However, it also works the other way - it says how many values the enum handles.

If you define an enum with just three values, if it has an underlying type of uint8, it handles 256 distinct values. You can take any integer up to 255, cast it to that enum type, and get a "valid" enum value. When branching on an enum, you need to keep in mind that you might get an undefined enum value, especially if it was deserialized from the wire.

To add insult to injury, compilers won't warn you by default. Only the pattern matching does for C#. C++ can warn you if you don't cover a defined enum value in a switch statement, but you must not use the default case - preventing you from correctly handling ill-formed values.

#tuesdaycodingtips #programming #cplusplus

Last updated 1 year ago