Ovidesvideo wrote in news:20***************************@mb-m17.aol.com
in comp.lang.c++:
Just a quick question. If I declare functions in the class declaration
as such:
class myclass
{
public:
void function(int &x)
{
x++;
}
};
Will the function be called normally, or simply inlined in the code?
That is implementation defined (i.e. its upto your compiler), but this
rule applies to *all* inline functions. Many compilers have options that
let you control how they handle this situation so read the manual.
When compiling debuggable code some compilers won't inline anything.
Some compilers (when optimizing) will inline functions that wern't
defined as inline.
But for normal (non-debug) code you can reasonable expect that small
functions like your example will be inlined, you just can't rely on it.
Rob.
--
http://www.victim-prime.dsl.pipex.com/