News for hackers. Stuff that matters.
Re:Trying out C++20's modules with Clang and Make by miki123211 on Sunday October 15, 2023 @02:17PM (#37892019)
Is there any specific reason why we should prefer a module system as it exists in C++ over something like the SQLite's approach with Makeheaders[1]?

As far as I understand it, they have a tool that can parse all their (C) files, figure out what each file declares and what declarations it depends on, and then autogenerate a header for every file with just the declarations it requires.

It seems like a sensible approach, but nobody besides sQLite and Fossil (which comes from the same developers) seems to be using it, either in C or C++, which leads me to suspect that there are caveats I don't know about. Is there a reason why this is a bad idea?

[1] https://fossil-scm.org/home/doc/trunk/tools/makeheaders.html

Re:Trying out C++20's modules with Clang and Make by mathstuf on Sunday October 15, 2023 @02:30PM (#37892114)
Probably because things that don't get "used" can still affect things. There's a lot of detail in name lookup algorithms and SFINAE where computing what you end up using and giving each TU its own view is probably not much savings over using the headers as-is.
Re:Trying out C++20's modules with Clang and Make by david2ndaccount on Sunday October 15, 2023 @03:23PM (#37892575)
This works for C, but not C++. And for C, it’s not that hard to do by hand so no one else bothers.