When compiling multiple source files
Jacob Carlborg
doob at me.com
Mon Aug 19 23:48:43 PDT 2013
On 2013-08-20 00:27, ProgrammingGhost wrote:
> Is it possible that if I just try to compile 1 file it could imports
> enough libraries that import/need the definitions for additional large
> libraries which in turn also imports everything causing ram issues? I'm
> sure in practice this will almost never happen. But I don't doubt there
> are main libraries that use other large libraries and everything
> imports/uses everything
It's theoretically possible. But one big difference between D and C/C++,
is that D uses symbolic inclusion where C/C++ uses textual inclusion. In
C/C++ you end up with these enormous translation units due to this. This
won't happen in D.
In C/C++ when you see "include <stdio.h>", for example, the preprocessor
will basically copy-paste the content of stdio.h to where the include
was located. In D the compiler just makes a note that a given file
includes another, no content is copied.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list