4

There is a Working Draft, Extensions to C++ for Modules (found in Experimental C++ Features). If this becomes Standard, what will it mean for traditional headers?

I mean, when I hear about importing a module, I think about Angular or Python, where I exclusively import things, not include them.

Does that mean that the module system will replace includes? Or they will play along, and be used where they are suited best?


Material like Include specific function from a header file into the code in c++ present it that way.

gsamaras
  • 71,951
  • 46
  • 188
  • 305
  • That's the intent. Gabriel Dos Reis gave a talk at CppCon2015 with a motivating example. The code the programmer sees will likely be the same order of size (in terms of LOC). But the code the *compiler* will have to see and go through, will be hundreds of % shorter. This should affect build time. – StoryTeller - Unslander Monica Oct 10 '17 at 14:49
  • That's what I thought about too @StoryTeller when I heard about it. However, I think it would be a good idea to ask the question, in order to get something more formal, and more information! (Thanks for the edit) – gsamaras Oct 10 '17 at 14:51
  • 4
    @StoryTeller hundres of %? one hundred % shorter is still too much? – 463035818_is_not_an_ai Oct 10 '17 at 14:51
  • @tobi303 - Work in reverse :P An inclusion bloats the translation unit by hundreds of %. So my intent was that the bloat is reduced by about the same order of magnitude (in theory). – StoryTeller - Unslander Monica Oct 10 '17 at 14:52
  • And yes. I hope the intent is to get rid of the preprocessor almost entirely. Leaving it with it's singular unique use, as a token concatenation mechanism. – StoryTeller - Unslander Monica Oct 10 '17 at 14:55
  • I'd still need to include for some macros. For example, I have a macro that use `__LINE__` and `__FILE__` for logging purposes. I think including it make it much more clearer than having macro exported, because it's clear you have preprocessor semantics. – Guillaume Racicot Oct 10 '17 at 14:59

0 Answers0