This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: std::pow implementation
- From: Joe Buck <jbuck at synopsys dot com>
- To: Paolo Carlini <pcarlini at unitus dot it>
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>, Robert Dewar <dewar at gnat dot com>, Richard dot Earnshaw at arm dot com, aoliva at redhat dot com, gcc at gcc dot gnu dot org, kgardas at objectsecurity dot com, rguenth at tat dot physik dot uni-tuebingen dot de
- Date: Wed, 30 Jul 2003 09:39:04 -0700
- Subject: Re: std::pow implementation
- References: <20030730141030.F0FABF2DFF@nile.gnat.com> <m3y8yg2it1.fsf@uniton.integrable-solutions.net> <3F27D757.70802@unitus.it>
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.