This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: interface/implementation: export keyword?
- To: tjw30 at cam dot ac dot uk
- Subject: Re: interface/implementation: export keyword?
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Thu, 29 Oct 1998 21:24:15 +0100
- CC: jbuck at synopsys dot com, egcs at cygnus dot com
- References: <Pine.LNX.3.96.981028112524.730K-100000@tjw30.joh.cam.ac.uk>
> Surely there must be an elegant way of doing this already, or does
> nobody else use templates and require them to be space-efficient?
egcs currently uses two techniques by default to safe space in
template instantiation:
a) In implicit instantiations, it emits code only if it is used in the
same translation unit. For example, if you instantiate a list<Foo>&
in a parameter, and then use only empty() on that parameter, it only
emits code for .empty() (this is the theory, some other things get
instantiated which would not need to)
b) If the same function/method is emitted multiple times in different
object files, the linker will remove the duplicates (if it's a GNU
linker)
This together more or less makes all other techniques
(-fno-implicit-templates, #pragma, -frepo) obsolete. 'export' will
survive (once it is born :-), as it is required by the standard.
Regards,
Martin