C++ automatic template instantiation?

Tudor Hulubei tudor.hulubei@ecora.com
Wed Apr 19 17:27:00 GMT 2000


  On Wednesday, 19 April 2000, Philipp Thomas wrote:
> Yes, the templates will be instantiated in each object as needed, so the sum
> of all object sizes wil grow and compile time most probably too. But on ELF
> platforms, all instantiations besides one will be discarded, so the in the
> end, the result should be the same.

It is not.  These are the sizes of our 5 binaries, w/ and w/o -frepo:

		w/o -frepo  w/ -frepo

binary #1:	1789312      846304
binary #2:	3281592     2006712
binary #3:	 774176      512448
binary #4:	1067408      623248
binary #5:	1649944     1171096

I think the size reduction is huge, and it is worth using -frepo to
get it, it is just that is soooo painful...

Moreover, we were unable to resolve all the undefined symbols (they
are mangled and c++-filt can't unmangle them) in one of our most
template intensive libraries, and thus I believe the size can be
decreased even further.

Tudor



More information about the Gcc mailing list