4 ms·
So will clang, gcc, and msvc all have different implementations modules?
by qweqwweqwe-90i 5y ago
So will clang, gcc, and msvc all have different implementations modules?
- steveklabnik 5y agoThey'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.)
- not2b 5y agoThere'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.
- gumby 5y ago> 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.
- summerlight 5y agoYeah, 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 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.
- bigcheesegs 5y agoYes. There are no plans for binary module compat between compilers, or different versions of the same compiler for gcc and Clang.