GCC 16 has been released
115 points
2 hours ago
| 3 comments
| gcc.gnu.org
| HN
gavinray
8 minutes ago
[-]
I want to point out an implemented feature that people SHOULD be adopting but that I doubt will be picked up:

  P2590R2, Explicit lifetime management (PR106658)
This is for "std::start_lifetime_as<T>". If you have not heard of this before, it's the non-UB way to type-pun a pointer into a structured type.

Nearly all zero-copy code that deals with external I/O buffers looks something like:

  std::unique_ptr<char[]> buffer = stream->read();
  if (buffer[0] == FOO)
    processFoo(reinterpret_cast<Foo*>(buffer.get())); // undefined behavior
  else
    processBar(reinterpret_cast<Bar*>(buffer.get())); // undefined behaviour
With this merged, swap the reinterpret_cast for start_lifetime_as and you're no longer being naughty.

https://en.cppreference.com/cpp/memory/start_lifetime_as

reply
groundzeros2015
4 minutes ago
[-]
You’re allowed to type pun char buffers.
reply
xzstas
27 minutes ago
[-]
I've already been using it for some time (debian sid has a trunk package). it has c++26 reflection, so I already do some magical things with reflection (much better for some cases e.g. for ser-des). I only wish they had a lsp server in their eco-system!
reply
klaussilveira
21 minutes ago
[-]
libstd has been giving me issues running gcc 16 binaries on Debian 12 and 13.
reply
t-3
1 hour ago
[-]
Somehow I never realized that GCC has a very regular release schedule until looking it up just now: https://gcc.gnu.org/develop.html
reply
bluGill
9 minutes ago
[-]
Large projects have been going to regular scheduled releases for a long time. Until the 90's people thought they could waterfall a large release with all your desired features (and for tiny projects this is still a good idea), but as your projects grow (possibly just to small) you reach a point where someone is always working on a feature that isn't ready yet, so a regular release means you still can support your customers with releases. This forces developers who are unsure they will be ready to have some sort of "disabled this unstable feature" toggle, which is about the best you can do.
reply
cogman10
4 minutes ago
[-]
Yup. OpenJDK is one of the best success stories of this.

Up until Java 8, they would release once features were complete. But that meant there were years between the 7 and 8 release and even more years between the 8 and 9 release.

The industry had gotten into the habit of always running old versions of Java (my company was on 6 for an uncomfortable amount of time. But others have had it worse).

More frequent smaller releases has gotten companies more into the habit of updating frequently which also, very helpfully, gives devs new features frequently.

reply
uyjulian
53 minutes ago
[-]
It has been that way since people from Cygnus (now RedHat->IBM) reorganized the project
reply
r2vcap
56 minutes ago
[-]
Yeah, GCC’s recent major releases have been remarkably regular, much like Fedora’s spring releases, and their releases seem to fit into the same broader rhythm. Hint? Red Hat.
reply
tosti
1 hour ago
[-]
IIRC, since GCC got covered by GPL3.

It used to be slower and I've spent way too much time working around C++ bugs in GCC 2.95

(The fact that I remember the problematic version is telling :)

reply
gpderetta
58 minutes ago
[-]
Everybody remembers that specific version :). And I wasn't even programming professionally at that time!
reply
bluGill
5 minutes ago
[-]
For many years that was the only version that could be used. What become gcc3 took years. In the end it was better, but for a while gcc 2.95 was the best we had despite the bugs.
reply
physicsguy
27 minutes ago
[-]
They changed their major release numbers too tbf. 4.x it was point release per year, now it's a major release per year.
reply