I was told that to create short functions / methods that are often called built-in using the inline keyword and writing the body in the header file. This was to optimize the code, so there would be no overhead for the actual function call.
What does it look like today? Do modern compilers (Visual Studio 2010 in this case) build such short functions automatically or is it still "necessary" to do it yourself?
inlinehas always been a hint to the compiler, and these days, most compilers make their own decisions in this regard (see register).
inline
register
inline, . , , : - , , .
, , , . , inline, , , . (, , static, )
static
, inline , "" , . , , .
, non-inline, , .
C4710, , , , .
C4711, , , inlining.
, , , , .
:
inline , ..
__forceinline ( __ attribute __((always_inline)) gcc). .
__forceinline
__ attribute __((always_inline))
__forceinline / .
Microsoft - , , /GL /LTCG . : , /LTCG.
/GL
/LTCG
, , :
, ( ) , ( ) . inline .
( ), , .
, , , inline. :
Does the compiler accept when to embed my functions (in C ++)?