views:

155

answers:

4

C++ ISO standard says: "A function defined within a class definition is an inline function." *

Do you know about any compilers that IGNORE this rule?

Do you know about any compilers that WILL NOT put that 'inline suggestion' there?

(please do not repeat the theory about inlines, I am aware of that - I need a practical answer)

+1  A: 

All compilers are allowed to ignore any inline suggestions they decide to. If they decide the function is too complex, for example, it won't be inlined. If you ever take the address of the function, the function may be inlined in some places, but a full function generated somewhere else for the address to point to.

Think of inline and the implicit inline when you define a function in a class definition as suggestions to the compiler.

Eclipse
A: 

In gcc you can use

-finline-limit=n
-fno-inline
Mykola Golubyev
A: 

It is not a rule, it is simply a statement of fact. The spec is simply stating that the function is defined inline. That makes it easier for the compiler to actually inline the generated code as well, but nowhere does the standard require this.

They're different concepts. What the generated code looks like is up to the compiler alone, and the standard doesn't really impose any requirements (except of course that it should behave as specified).

jalf
A: 

See my answer to a very similar question: http://stackoverflow.com/questions/582919/when-is-inline-ineffective-in-c/582932#582932

Summary: inline is only required to allow multiple definitions. Any function calling changes is purely optional.

Richard