News for hackers. Stuff that matters.
Re:C++20 Modules with GCC11 by qweqwweqwe-90i on Wednesday August 18, 2021 @08:47PM (#28229076)
So will clang, gcc, and msvc all have different implementations modules?
Re:C++20 Modules with GCC11 by steveklabnik on Wednesday August 18, 2021 @08:49PM (#28229091)
They're different codebases, so as far as I know, they'll have different implementations, sure.

But modules themselves are standardized, and so you should expect that after some time, you'll have stuff that works on all implementations. I don't believe that any of them are complete yet, which is why you see these differences currently.

(Caveats: I have followed the development of modules semi closely but am by no means an expert.)

Re:C++20 Modules with GCC11 by not2b on Wednesday August 18, 2021 @09:07PM (#28229208)
There's been a strong effort to have binary compatibility between compilers. The initial effort was funded by Intel when they launched Itanium and the resulting C++ ABI is used for other processor targets as well. So gcc, clang, and Intel's proprietary compiler are binary compatible modulo bugs.

But modules are very new and I doubt if enough corner cases are nailed down yet.

Re:C++20 Modules with GCC11 by gumby on Wednesday August 18, 2021 @09:52PM (#28229461)
> So gcc, clang, and Intel's proprietary compiler are binary compatible modulo bugs.

For generated code, definitely. But for example their standard libraries are different so you still can't, say, compile something in gcc that uses std::string and expect to be able to link it to something compiled with clang that uses std::string unless you are careful to use the headers (and .a files) of the same libc++ or libstdc++

I consider this a feature, not a bug -- diversity in implementation is a plus.

Re:C++20 Modules with GCC11 by summerlight on Wednesday August 18, 2021 @09:13PM (#28229242)
Yeah, all the compilers will have different implementations and ABI and it'd be unrealistic expectation for them to be completely compatible. Instead, IIRC the current approach is to have a compatible format for specific common tasks. There has been some effort in SG15 to ensure consistency/interoperability across module implementations which led to https://wg21.link/P1688R0. This was mainly due to difficulty of scanning dependencies for build systems so there needs to be a standardized format to consume module information. One caveat: this group has been inactive for a while due to the pandemic, unfortunately.
Re:C++20 Modules with GCC11 by bigcheesegs on Wednesday August 18, 2021 @11:21PM (#28229982)
Yes. There are no plans for binary module compat between compilers, or different versions of the same compiler for gcc and Clang.