[LC++]template and gcc

Vincent Penquerc'h Vincent.Penquerch at artworks.co.uk
Tue Mar 26 21:00:05 UTC 2002


> Actually, you don't need the export keyword to prevent 
> redundant code in 
> binaries, you just need smarter linkers to detect duplicate 
> code at link 
> time.  The export keyword is (I think) intended mainly to 
> speed up compile 
> time, rather than to reduce code size.

I *think* it's meant to tell the compiler that a particular
template will be used by other units of compilation, so the
compiler/linker/whatever must ensure that the code is generated
for whatever instanciations are actually used. That will most
probably be both the compiler and linker. It may reduce compile
time, but I don't think this was the original goal, which (I
think, I tried googling it up, but most hits are to pages
saying "We don't support it") was more a hint to the compiler
that something would be used somewhere else, and to act
accordingly.
Now, it's all fuzzy memory that I have, I could be very wrong,
in which case I apologize in advance :)

-- 
Vincent Penquerc'h 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/tuxcpprogramming/attachments/20020326/fc0bb294/attachment.htm 


More information about the tuxCPProgramming mailing list