If you change the module implementation but the interface is unchanged, you don't need to recompile -- at least that is the experience the Visual C++ compiler is trying to provide.
I think the context here (at least what johannes1971 is trying to point out) is that this only works if you put the module implementation and the module interface in an interface module and implementation module respectively. But what johannes1971 wants to do (if I'm interpreting correctly) is to put both the interface and the implementation in a single implementation module and not suffer from increased build times.
is that this only works if you put the module implementation and the module interface in an interface module and implementation module respectively.
There is an underlying assumption in this statement that build system relies solely on modified time of the file to decide on whether something has to be rebuild.
If we are not constrained by that assumption, I can see no fundamental problem in figuring out if users have to be rebuilt even if your entire module is in a single file. Turbo Pascal has been doing it in the 80s.
I have a module which exports a function inline int foo() { return 0; }. I compile an object file main.o which calls this function. Now I change foo() to return 1, but its interface does not change: at this point main.o has to be recompiled, since foo() might have been inlined in it, right ?
You could imagine an implementation that keeps track of which function definitions were imported and their hashes (it's not just inlining that's a problem) in main.o and then compares this with the module file to determine if a rebuild is needed. You could also imagine a mode that only imports always inline functions.
Current implementations do not do this, so as it stands you will get full rebuilds, but this can actually be solved properly in a modules world as opposed to headers.
4
u/GabrielDosReis Nov 01 '17
If you change the module implementation but the interface is unchanged, you don't need to recompile -- at least that is the experience the Visual C++ compiler is trying to provide.