This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: On inlining in C++
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Scott Robert Ladd <coyote at coyotegulch dot com>
- Cc: Robert Dewar <dewar at gnat dot com>, aph at redhat dot com, gcc at gcc dot gnu dot org
- Date: 06 Aug 2003 15:39:00 -0300
- Subject: Re: On inlining in C++
- Organization: GCC Team, Red Hat
- References: <20030805164617.90BF4F2DA4@nile.gnat.com><3F2FE907.7080608@coyotegulch.com>
Can we all agree with these statements, inferred from my reading of
the C++ Standard?
- inline functions are functions that are defined inside a class body,
or explicitly marked with the inline keyword.
- for inline functions, inline substitution is to be preferred over
the standard call sequences.
- a function may be defined in multiple translation units without
violating the ODR only if the function is inline and the definitions
are equivalent, as defined in the ODR.
- inline substitution doesn't modify the behavior of the program as
far as the abstract machine of the standard is concerned, so it
might be applied to non-inline functions as well, per the as-if
rule. Conversely, not performing inline substitution of an inline
function is legal, even if not to be preferred.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer