On Apr 25, 10:13 am, bor...@[EMAIL PROTECTED]
wrote:
> Hi all,
>
> to reduce the build-time of our project we use following trick:
>
> Instead of compiling each CPP and linking together, we auto-generate a
> CPP which includes all CPP of the project and compile only this one.
> The effect is that the compiler has to compile each involved header
> only once opposed to a per-cpp-file basis.
>
> The question is: once it compiled successfully (no duplicate
> definitions etc), is there any side-effect possible? Is the linked
> library/executable any different than the one produced the 'normal'
> way?
>
> There is one issue I already can think of: the order of the execution
> of constructors of static objects (like global variables). Any more?
{ edits: quoted signature & clc++m banner removed. please don't quote
extraneous
material. tia., -mod }
Hi,
File-scope entities, anonymous namespace contents, and preprocessor
#defines will merge.
These collisions will (in most cases) break the compilation. So, if
you don't see any
build problems you *might* be OK.
You could of course get silent program behaviour changes. Different
#defines and
overloads'/template specialization visibility are two things I can
think of.
BTW the initialization order of globals is not defined across
compilation units.
Your approach will actually defines it, as long as you don't shuffle
the files.
Radoslav Getov
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


|