On inlining in C++
Alexandre Oliva
aoliva@redhat.com
Wed Aug 6 19:49:00 GMT 2003
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
More information about the Gcc
mailing list