我研究过
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.
问题:
- 如果 GCC 编译器的优化关闭,内联说明符是否被忽略?
- 当递归调用内联函数时,哪个编译器选项决定“内联深度”,直到它遵循正常的函数调用机制?
- 如果在 for 循环内调用内联函数,是否会出现相同的“内联深度”?
最佳答案
If optimization is turned off for the GCC compiler, is the inline specifier ignored?
是的,如果在 GCC 中关闭优化,则不会内联任何函数。它相当于在编译期间使用 -fno-inline
标志。看这个link
-fno-inline
不要注意 inline 关键字。通常此选项用于防止编译器扩展任何内联函数。请注意,如果您不进行优化,则无法内联扩展任何函数。
When inline functions are called recursively, which compiler option determines the 'depth of inlining', until it follows the normal function call mechanism ?
选项 max-inline-recursive-depth
和 max-inline-recursive-depth-auto
。默认深度为 8。
关于c++ - GCC 编译器内联的深度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11175439/