This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: On inlining in C++


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]