This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: empty function optimizations


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]