gpt4 book ai didi

c++ - 我如何知道函数是否已内联?

转载 作者:IT老高 更新时间:2023-10-28 21:45:39 24 4
gpt4 key购买 nike

如果我将任何函数标记为内联,有没有办法知道该函数是否内联?

最佳答案

使用 GCC,您可以使用 -Winline 编译器选项:

  -Winline  Warn if a function can not be inlined and it was declared as inline.

gcc 的 man 文件继续说:

  Even with this option, the compiler will not warn about  failures to inline functions declared in system headers.  The compiler uses a variety of heuristics to determine whether or  not to inline a function.  For example, the compiler takes into  account the size of the function being inlined and the amount of  inlining that has already been done in the current function.  Therefore, seemingly insignificant changes in the source program  can cause the warnings produced by -Winline to appear or disappear.

关于c++ - 我如何知道函数是否已内联?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2585956/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com