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]
Other format: [Raw text]

Re: std::pow implementation


Gabriel Dos Reis wrote:
> >only some (C++) implementors have decided that they know better than
> >the programmer and they should not listen to the programmer assuming
> >that their uses of inline is nonsensical.

On Wed, Jul 30, 2003 at 04:33:59PM +0200, Paolo Carlini wrote:
> Gaby, your concept of "know better than the programmer..." reminds me 
> something I read years ago about the keyword "register". Is there 
> something we can learn from that? At the time I was convinced that the 
> programmer is not as good as Chaitin's register allocators ;) ...

The analogy between the keywords "inline" and "register" is often made,
but I think that it is inappropriate.  The reason is that we can do very
good register allocation based only on local information, where the same
is not true of many inlining decisions, which involve a more complicated
set of tradeoffs (other than for very small functions; for such cases the
compiler can reliably determine that an inlined call will be better by
every measure than a non-inlined call).  When the goal is optimization
for speed, detailed information about the cache and the execution profile
will be needed in many cases for an accurate decision.

In any case, at this stage in the state of the art of compiler
development, we are not even close to the day where it's a good idea
to just ignore the inline keyword.


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