4 ms·
How many modern compilers will let you write import std; in a C++ file and build the executable without shenanigans ? GCC 15 still does not let you compile a C+
by AlexeyBrin 1y ago
How many modern compilers will let you write import std; in a C++ file and build the executable without shenanigans ? GCC 15 still does not let you compile a C++23 code with:
g++ -std=c++23 -fmodules foo.cpp
Without manually generating the std module first. Until all compilers will directly accept the import keyword it won't be adopted on a large scale by regular programmers.
- pjmlp 1y agoVisual C++ and clang. Many projects do just fine sticking to a single compiler. Not for everyone, but they exist nonetheless, including on FOSS world.
- AlexeyBrin 1y agoAFAIK, Clang (like GCC) needs an extra step to compile the standard modules files. It does not work, as one would reasonably expect, with something like: clang++ -std=c++23 fname.cpp (I know you can use Cmake to solve it - but I want a simple solution something that can be shown to a junior programmer.)