Reputation: 6685
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:
Upvotes: 8
Views: 1644
Reputation: 86
Besides -fno-inline, you also need to use -fno-default-inline to disable inline functions in classes. This is useful when you use gdb to step into those inline functions.
Upvotes: 2
Reputation: 1729
If optimization is turned off for the GCC compiler, is the inline specifier ignored?
Yes, if optimization is turned off in GCC, no functions would be inlined. It is equivalent to using -fno-inline
flag during compilation. See this link
-fno-inline
Don'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.
When inline functions are called recursively, which compiler option determines the 'depth of inlining', until it follows the normal function call mechanism ?
Options max-inline-recursive-depth
and max-inline-recursive-depth-auto
. Default depth is 8.
Upvotes: 7