3 ms·
thanks! this is interesting! for me, with the something_with_templates commented out, that gives these errors: $ g++ -Wall -Werror -O -std=c++23 pjmlp
by kragen 3y ago
thanks! this is interesting!
for me, with the something_with_templates commented out, that gives these errors:
$ g++ -Wall -Werror -O -std=c++23 pjmlp-hello.cc -o pjmlp-hello
pjmlp-hello.cc:1:1: error: ‘import’ does not name a type
1 | import std;
| ^~~~~~
pjmlp-hello.cc:1:1: note: C++20 ‘import’ only available with ‘-fmodules-ts’, which is not yet enabled with ‘-std=c++20’
pjmlp-hello.cc: In function ‘int main()’:
pjmlp-hello.cc:5:8: error: ‘println’ is not a member of ‘std’
5 | std::println ("Hello World");
| ^~~~~~~
$ g++ -Wall -Werror -O -std=c++23 -fmodules-ts pjmlp-hello.cc -o pjmlp-hello
In module imported at pjmlp-hello.cc:1:1:
std: error: failed to read compiled module: No such file or directory
std: note: compiled module file is ‘gcm.cache/std.gcm’
std: note: imports must be built before being imported
std: fatal error: returning to the gate for a mechanical issue
compilation terminated.
so it looks like it could conceivably be super fast if it worked. perhaps std.gcm should be included in the libstdc++ package or built as part of apt install?
still, though i wasn't able to test, i anticipate some slowness due to the semantic model of template expansion, which is one step removed from preprocessor textual expansion
- pjmlp 3y agoYou have chosen the compiler that currently has worst support for modules from the big three. Try the same with Visual C++, the currently leading one in ISO C++ support. When std still isn't available as compiled module, Build started at 12:21... 1>------ Build started: Project: ConsoleApplication1, Configuration: Debug x64 ------ 1>Scanning sources for module dependencies... 1>std.ixx 1>std.compat.ixx 1>Compiling... 1>std.ixx 1>std.compat.ixx 1>ConsoleApplication1.cpp 1>ConsoleApplication1.vcxproj -> C:\.......\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== ========== Build completed at 12:21 and took 08,078 seconds ========== After changing the message contents and recompiling, Build started at 12:22... 1>------ Build started: Project: ConsoleApplication1, Configuration: Debug x64 ------ 1>Scanning sources for module dependencies... 1>ConsoleApplication1.cpp 1>ConsoleApplication1.vcxproj -> C:\.....\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== ========== Build completed at 12:22 and took 00,567 seconds ==========
- kragen 3y agoit took 567 milliseconds to compile six lines of code? i used to use visual c++ last millennium when people paid me to, but i recall it compiling more than eleven lines of code per second, even on the hardware of the time