This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: std::pow implementation
- From: Bernd Schmidt <bernds at redhat dot com>
- To: Richard dot Earnshaw at arm dot com
- Cc: Joe Buck <jbuck at synopsys dot com>, Robert Dewar <dewar at gnat dot com>,aoliva at redhat dot com, gcc at gcc dot gnu dot org, gdr at integrable-solutions dot net,rguenth at tat dot physik dot uni-tuebingen dot de, s dot bosscher at student dot tudelft dot nl
- Date: Mon, 4 Aug 2003 19:44:02 +0100 (BST)
- Subject: Re: std::pow implementation
- References: <200308041754.h74HsRP03291@pc960.cambridge.arm.com>
On Mon, 4 Aug 2003, Richard Earnshaw wrote:
> The issue here isn't what to do with really tiny functions, or even what
> to to with really enormous ones: it's entirely to do with the boundary
> between the two -- how does the compiler decide that it has crossed from
> one to the other? A smart compiler can work that out based on its
> knowledge of the machine. A dumb one can't. Do we want gcc to be smart
> or dumb?
It's not about we want. Wishful thinking doesn't help. It's about two
facts:
a) gcc is currently dumb
b) the inline keyword has only one reasonable meaning, regardless of
whether the compiler is smart or dumb.
To repeat the argument:
If we have a dumb compiler, the choices it makes are effectively random.
The programmer can get a big improvement by using inline carefully, iff
the compiler honours it. If it makes another random choice, the keyword
is effectively useless.
If we have a smart compiler, we can rely on it making good choices in
almost every case. We don't generally need to use inline, but there may
be cases where a human could demonstrate that it can improve code, iff
the compiler honours it.
The only imaginable alternative, for a really smart compiler, is to treat
the inline keyword as having no meaning at all, like register. So far, no
one has demonstrated the existence of a sufficiently smart algorithm.
Bernd