logoalt Hacker News

GCC 16 has been released

280 pointsby HeliumHydrideyesterday at 11:40 AM51 commentsview on HN

Comments

gavinrayyesterday at 1:46 PM

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

show 4 replies
t-3yesterday at 12:36 PM

Somehow I never realized that GCC has a very regular release schedule until looking it up just now: https://gcc.gnu.org/develop.html

show 4 replies
xzstasyesterday at 1:26 PM

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!

show 1 reply
kmoseryesterday at 6:52 PM

> The so-called "json" format for -fdiagnostics-format= has been removed in this release. Users seeking machine-readable diagnostics from GCC should use SARIF.

But:

> GCC can now output diagnostics in HTML form via -fdiagnostics-add-output=experimental-html

I wonder what drove the decision to remove JSON output and add HTML output?

show 1 reply
wg0yesterday at 3:57 PM

Noob question - Does gcc use LLVM anywhere under the hood or it has its own code generation and optimization pipeline? How does it stack in comparison to LLVM?

show 4 replies
dapperdrakeyesterday at 1:54 PM

Does -Ofast still ignore -fno-fast-math ?

shevy-javayesterday at 3:01 PM

I tried the unstable sources for a while, in the last ~3 months. I ran into some issues with some programs (could not compile them with recent GCC, but older GCC worked fine), so gcc 15.x works better for me in general (presently) - but from, say, +3000 programs to compile, the vast majority works well, and a few may need patches (which can often be found in LFS/BLFS by the way, they often use sed instructions to fix individual things and then it works usually).

Hopefully they fixed those issues. We all need stability and things-to-work.