"pmatos" <[EMAIL PROTECTED]> writes:

> Will an inlined empty function have any performance penalty,

Yes under some conditions, no under other conditions.

Gcc will not inline any function at all if you compile without
optimization. Even with -O2, some versions of gcc will not inline
functions that are used before their body is available, e.g.

  struct Foo {
      int foo() { return bar(); }
      int bar() { return 42; }
  };
  int func() { Foo f; return f.foo(); }

The call to foo() is inlined (with -O3) by both g++-2.95 and
g++-3.4.3, but call to bar() is only inlined by g++-3.4.3.

> i.e., will g++ generate any code at all for it?

This question is not the same as the first one.

If you take address of an inline function, g++ will be forced to
define the symbol and produce code for it. But this is orthogonal
to whether calling this function has any performance penalty
(i.e. whether the function *call* is inlined or not).

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
Help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to