Re:Trying out C++20's modules with Clang and Make
by mathstuf on Sunday October 15, 2023 @02:27PM
(#37892092)
Unlikely to be fixed. The module files are basically AST dumps and no compiler keeps that stable over time.
Even flag selections make incompatible BMIs. So if one TU uses C++20 and another uses C++23, they'll each need their own BMI of anything they import.
FD: CMake developer that implemented the modules support
Re:Trying out C++20's modules with Clang and Make
by maccard on Sunday October 15, 2023 @03:09PM
(#37892467)
If module files are pretty much memory dumps that makes it all the more frustrating that it's taken this long, given thats what precompiled headers essentially are.
Re:Trying out C++20's modules with Clang and Make
by mathstuf on Sunday October 15, 2023 @04:56PM
(#37893317)
There are new rules about "reachability" and "module linkage". Not to mention things like methods defined within the class declaration are no longer as-if `inline` when within a module. It's not just "a faster preprocessor" mode; there are real rules associated with module boundaries.
Re:Trying out C++20's modules with Clang and Make
by leni536 on Sunday October 15, 2023 @02:34PM
(#37892145)
C++ has stable binary interfaces just like C.
Re:Trying out C++20's modules with Clang and Make
by matheusmoreira on Sunday October 15, 2023 @02:46PM
(#37892259)
I've seen compiled C++ code turn out to be incompatible with code produced by different versions of the same compiler. There is no way this is stable.
Re:Trying out C++20's modules with Clang and Make
by maccard on Sunday October 15, 2023 @03:08PM
(#37892465)
Most compiler vendors promise forward compatible stability and have done for a while now. You're never going to have perfect compatibility, as I can always just compile with -DMY_FLAG=1 and change the behaviour of everything. But, GCC and clang haven't had a breaking change in a decade, and I believe msvc has been compatible since 2015.
When will they fix this? People keep using C to this day because these unstable binary interfaces make it so no one can reuse software. Can't write a library in almost any other language and expect it to just work. To this day, C is the lowest common denominator of software because of stuff like this.