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


> > Would collecting all the identical code at link time be as easy as it
> > sounds, or are there complications?
>
> Some conforming programs would break, but these are fairly obscure (e.g.
> programs that compare function pointers).  Debugging might get harder.

Thanks for the follow up guys.  The debugging argument is pretty simple to
answer -- turn it off.  When debugging you already have a hard drive full of
dwarf info, so you'd hardly be worried about duplicate object code.  The
only point of this is to reduce object bloat.

> But if you factor out common code, you can get greater savings than the
> compiler can find and your gains are portable.

Factoring might be a fair solution for the Linux folks' empty functions.
That was Geert's original proposal.  Unfortunately the source of my problem
is mostly C++ templates.  I don't have control to factor out the common
code.  Well, sure I could have control but then that is like saying "don't
use templates".

I understand this could break conforming programs, but honestly I have to
say comparing function pointers for equality is in pretty bad taste
(entirely IMHO).  There are other ways to handle situations where you would
do that, especially when you are coding in C++ and have virtual functions.
I'd gladly give up being able to compare function pointers in exchange for
loosing some template bloat.

Ken


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