开发者

How do I use gcc's inline report (-Winline)

Enabling -Winline on my project produces a whole lot of output wh开发者_StackOverflowich I don't really understand. Does anyone know how to use this output to figure out why my particular function wasn't inlined?


Well, according to my gcc man page...

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.

I don't believe that you can force the compiler to inline your function; it's an implementation detail that could even change when the compiler is updated. Besides, as long as the compiler's choice causes your function to run faster, is there any particular reason that you care whether the function is actually inlined or not?

Of course, if you really want to inline your function for some reason, you could probably just use a macro to do so.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜