This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: empty function optimizations
- To: ken at gesn dot com
- Subject: Re: empty function optimizations
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Tue, 11 Jul 2000 23:19:08 +0200
- CC: gcc at gcc dot gnu dot org
- References: <NCBBIGGNCKBDKCCGPEOAIEDFDKAA.ken@gesn.com>
> This came up on the Linux kernel list yesterday, but I have been thinking
> about this for a long time. In our C++ project, we use container templates
> fairly heavily. The problem is that often the templates generate function
> code that is independent of the class, or maybe only dependent on the class
> sizeof. With hundreds of classes it really adds up.
>
> Would collecting all the identical code at link time be as easy as it
> sounds, or are there complications?
Well, just take one of your examples. Please post a class template
with some method, where the template is instantiated with two
different types, but the method "ought to" be identical. My guess is
it won't be possible to merge them just by looking at the machine code.
Regards,
Martin