This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: std::pow implementation
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: Richard dot Earnshaw at arm dot com, Scott Robert Ladd <coyote at coyotegulch dot com>, Alexandre Oliva <aoliva at redhat dot com>, Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>, gcc at gcc dot gnu dot org
- Date: Wed, 30 Jul 2003 18:24:52 +0100
- Subject: Re: std::pow implementation
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> Richard Earnshaw <rearnsha@arm.com> writes:
>
> [...]
>
> | > When I say "inline", I mean inline, regardless of other opinions
> | > (including those of the compiler).
> |
> | Really? And when you say "register" do you really mean that?
>
> It is tempting to make the analogy with "register", but you have to
> acknowledge the fact that inlining strategy is not at the same level
> of sophistication as register allocation. Therefore, any answer you
> get for the question above is irrelevant to whether you should decide
> whether your programmed inliner always knows better than the
> programmer. Until then, please listen to the programmer. Don't
> transmute "inline".
I'm not arguing that the current implementation of inline is perfect (it's
clearly not), just that the intent of the two keywords are conceptually
similar -- it's an indication to the compiler of the programmer's intent.
If the original C specification had said that "register" meant "register"
unconditionally, then the situation wouldn't have been any different --
the compiler would have to obey the user, even if the compiler could do
better. The same is also conceptually true with inline; if its meaning
becomes "you, the compiler, have no choice in this decision" then it
doesn't matter how smart the compiler can become it still has to obey the
directive. This, IMO, is clearly incompatible with the intent of inline,
even as Stroustrup originally intended it.
R.