Re: What is the gain of "inline"



In article <421dd75c-e08e-44ee-acbb-fa832c142dc4@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> gwowen <gwowen@xxxxxxxxx> writes:
On Dec 10, 8:39=A0am, gwowen <gwo...@xxxxxxxxx> wrote:

I can only think of one place where C++ mandates inline (in
the absence of an explicit "inline" and thats when the definition of a
member function is included in the class definition. =A0What are the
others?

Reference to r7.1.2 [dcl.fct.spec] in the C++ standard confirms this.
A function in C++ is never mandated to be inline. The keyword is only
ever a hint, but member functions defined with a class definition are
implicitly specified as if declared "inline".

So even in that case it is no more than a hint. So apparently C++ *never*
mandates an actual inline.
--
dik t. winter, cwi, science park 123, 1098 xg amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
.



Relevant Pages

  • Re: What is the gain of "inline"
    ... the absence of an explicit "inline" and thats when the definition of a ... member function is included in the class definition. ... A function in C++ is never mandated to be inline. ...
    (comp.lang.c)
  • Re: VC++2003: Methods implemented outside class body are never inlined for templates that are instan
    ... > ignore any subsequent request to inline it. ... "A member function may be defined in its class definition, ... > be classified as a compiler bug. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Using inline
    ... of a member function went if it was to be inline. ... in my understanding, is that the function body can go in the class ... implementation file with the "inline" specifier. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: LNK2005
    ... If you move the member function definition outside the class definition then ... >>you have to use the inline keyword there also. ... small I don't worry about code bloat ...
    (microsoft.public.vc.language)
  • Re: Using inline
    ... > of a member function went if it was to be inline. ... header file in all source files that use the class. ... In order for the compiler to generate code for a function inline, ...
    (alt.comp.lang.learn.c-cpp)