4 ms·
> For example, consider math.h. If your program is using one function (say, sin) from math.h, you have to parse all the prototypes in math.h. (And if you have i
by shawn-butler 11y ago
> For example, consider math.h. If your program is using one function (say, sin) from math.h, you have to parse all the prototypes in math.h. (And if you have inlined functions or templates in the header files, you have to parse those too!)
Isn't this pretty much a solved problem with precompiled / pre tokenized headers? PTH are language / arch / compiler agnostic.
http://clang.llvm.org/docs/PTHInternals.html http://clang.llvm.org/docs/PTHInternals.html
- pcwalton 11y agoPrecompiled headers inch C and C++ closer to a module system, by discarding the traditional notion of what a header is: it becomes a sort of binary metadata instead of a textually included file. But why not just start with the right thing in the first place?
- ufo 11y agoPrecompiled headers are a big hack. As pcwalton mentioned, the problem was actually solved when people invented real module systems.
- the_why_of_y 11y agoWhich, notably, happened decades before the first implementation of the precompiled headers hack.
- TillE 11y agoYes. Well. And just a few short decades later, modules will most likely make it into C++17.
- steveklabnik 11y agoIn my understanding, they won't: https://botondballo.wordpress.com/2015/06/05/trip-report-c-standards-meeting-in-lenexa-may-2015/ https://botondballo.wordpress.com/2015/06/05/trip-report-c-s... > Modules making it into C++17 is less likely. However, they do say > That said, from a user’s perspective, I don’t think this is any reason to > despair: the feature is still likely to become available to users in the > 2017 timeframe, even if it’s in the form of a TS.
- comex 11y agoNote that Clang has been working on a true module system for C and C++: http://clang.llvm.org/docs/Modules.html http://clang.llvm.org/docs/Modules.html