I have studied that
The inline specifier is a hint to the compiler that it should attempt
to generate code […] inline rather than laying down the code for the
function once and then calling through the usual function call
mechanism.
Questions:
- If optimization is turned off for the GCC compiler, is the inline specifier ignored?
- When inline functions are called recursively, which compiler option determines the ‘depth of inlining’, until it follows the normal function call mechanism ?
- If the inline function is invoked inside a for loop, does the same ‘depth of inlining’ come into the picture ?
Yes, if optimization is turned off in GCC, no functions would be inlined. It is equivalent to using
-fno-inlineflag during compilation. See this link-fno-inlineDon't pay attention to the inline keyword. Normally this option is used to keep the compiler from expanding any functions inline. Note that if you are not optimizing, no functions can be expanded inline.Options
max-inline-recursive-depthandmax-inline-recursive-depth-auto. Default depth is 8.