|
|
Log in / Subscribe / Register

not really C++20

not really C++20

Posted May 1, 2026 11:10 UTC (Fri) by jamesh (guest, #1159)
In reply to: not really C++20 by rolexhamster
Parent article: GCC 16.1 released

One possible outcome with something like this is that the feature becomes optional in a future version of the language. This happened with C99 variable-length arrays, which became optional in C11.

C++ modules seem like they would be a lot easier to implement if the language had a standard build system (like Rust has with Cargo, or Go has with it's "go" tool chain frontend). It's not the kind of thing you can easily implement in just the compiler. And to add support to a build system you need to know how the specific compiler you're using expects this all to work.


to post comments

not really C++20

Posted May 1, 2026 15:11 UTC (Fri) by mathstuf (subscriber, #69389) [Link]

Eh. I've worked on implementing C++ modules for CMake. The issue, as I see it, is that the transition mechanism (header units) are all of the hardest cases of named modules at once. So projects can't make the jump without leaving their consumers behind, maintaining two variants of the build, or some cursed hybrid attempting to support both at once.

There's also the fact that modules are a "new" kind of dependency (well, Fortran had it, but hacks could work around that) that isn't natively supported by the likes of Makefile. It took C++ modules landing to convince Ninja maintainers to accept our patch from 2015 or so which was used by CMake for Fortran support (dyndeps).

I know that…some other developers have griped about CMake's approach, but there are definitely cuts one can make to the supported use cases to make the implementation simpler, but you're definitely leaving use cases on the floor when doing such decisions.

Luckily, the implementations were amenable to P1689 (my ISO paper for dependency communications) which provides the building block that build systems require to properly build modules in the most complicated scenarios.

Documentation for CMake's implementation is here (which includes said use cases and how CMake handles them): https://cmake.org/cmake/help/latest/manual/cmake-cxxmodul...


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds