This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: On inlining in C++
Gerald Pfeifer <gerald@pfeifer.com> writes:
| On Tue, 5 Aug 2003, Joe Buck wrote:
| > Fine. Then accept Gaby's proposal as a stopgap solution until we can
| > produce an automatic inliner that is any good.
|
| I tried to keep out of this, but -- let's see numbers, please.
I would like people realize that "C++ inline" is not just about
numbers. "C++ inline" is not an alias to "optimize". Among other
things, it is statement of programmer's preference for an alternate
function call mechanism.
7.1.2/3
[...] The inline specifier indicates to the implementation that
inline substitution of the function body at the point of call is to
be preferred to the usual function call mechanism. [...]
The intent is clear.
Moreover -- something I'm not proposing for g++ --, "C++ inline" is an
actual request for ABI change in the sense that if in a translation
unit -- therefore in all translation units -- the copy constructor is
inline and the class is simple enough, the compiler can pass the data
in register, not in stack. That function call mechanism provides
optimal efficiency for class types abondantly used in programming in
C++, starting with the standard library itself.
In other words, "C++ inline" goes beyond random numbers.
But as I said, I'm not proposing an ABI breakage.
-- Gaby