To make the function inline use the inline keyword:
inline int maximum( int x, int y, int z ) // note the inline keyword
{
int max = x;
if ( y > max )
max = y;
if ( z > max )
max = z;
return max;
}
If the function is a member of a class/struct then simply defining it inside the class (as apposed to outside it) makes it inline.
Say you have the call:
int f = maximum(3, 4, 5)
The compiler might expands the call to something like:
int max = x;
if ( y > max )
max = y;
if ( z > max )
max = z;
int z = max;
There's some overhead to calling a function, so inline functions give you the convenience of functions along with the performance of C macros. But that's not to say you should always use them, in most cases the compiler is better at deciding when optimizations like this are needed and might not even honor your request.
You can read more about inline functions and how (and when) to use them at C++ FAQ Lite and this GotW