While it is very likely that GetNum() will be inlined by the compiler, there is no way to force the compiler to inline a chunk of code. Some compilers don't even support inlining of functions. If the compiler didn't inline the function, you'd have the overhead of a function call; whether this is a big deal depends on how often you call the function.