What brings an upgrade to GCC 14 from GCC 13?

published at 29.09.2024 20:32 by Jens Weller
Save to Instapaper Pocket

Recently I wondered what I get in term of C++ features for upgrading my system from version 13 to 14 of GCC...

Now, of course - a lot of bug fixes. Its surely a good idea to upgrade. But that doesn't answer my question. So a quick look at C++ compiler support showed that there is some interesting features, and mostly first C++26 support becoming available is one of them. Other features are more important to me though.

C++23 features

GCC 14 adds support for std::generator to coroutines. I'm not a coroutine user though, which makes this a nice to have. But the code example shows you how to traverse a tree with std::generator without using much else from coroutines, maybe this is a little more interesting then I thought...

Explicit object member functions may get overlooked, but its also known as deducing this. Its a great way to implement CRTP and has other uses. This one is interesting. It also allows you to only have one implementation for member functions which so far needed to exist for const and non-const instances.

I'm not sure if I have a use for the new stacktrace library, but its nice to have this enabled by default now. Also std::inout_ptr/std::out_ptr seems nice, but not sure where I would use them. But good to know that there is more now in our language to express such things when calling C functions.

Partial support for ranges::to is also interesting. And while we're at ranges, pipe support for user-defined range adaptors (ranges::range_adaptor_closure, std::bind_back) seems nice too.

With <print> there is a new header. print and println are great for hello world. But I do wonder if in case I'd need such functionality I'd use the standard versio or the fmt library. And with forward_like there is a new type cast.

C++20 features

C++20 is mostly implemented, except that since GCC 11 there is partial module support, no change to this it seems.

But for chrono there is an update, Calendar and Timezones are now fully supported. From the compiler support page it seems this is adding parse and from_stream.

C++26 features?

Its rather nice that we already have support for some features for a standard getting released in two years. But C++23 was not such a big standard, C++26 seems to aim at that. I see that GCC14 brings some more support for freestanding. Most of the C++26 features supported seems to be the "low hanging fruit", GCC 15 brings more interesting features. But user generated static_assert messages seems to be a nice one, and C++26 is still in its early days and implementers should take their time.

You should expect some more news abotu C++26 during the fall committee meeting and maybe during Meeting C++ 2024 the week before?

 

Join the Meeting C++ patreon community!
This and other posts on Meeting C++ are enabled by my supporters on patreon!