3 ms·
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
by miki123211 3y ago
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 https://fossil-scm.org/home/doc/trunk/tools/makeheaders.html
- mathstuf 3y agoProbably 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.
- david2ndaccount 3y agoThis works for C, but not C++. And for C, it’s not that hard to do by hand so no one else bothers.