C++ inline functions using GCC - why the CALL?

后端 未结 7 672
感动是毒
感动是毒 2020-12-28 17:55

I have been testing inline function calls in C++.

Thread model: win32
gcc version 4.3.3 (4.3.3-tdm-1 mingw32)

Stroustrup in The C++ Program

7条回答
  •  粉色の甜心
    2020-12-28 18:16

    Like Michael Kohne mentioned, the inline keyword is always a hint, and GCC in the case of your function decided not to inline it.

    Since you are using Gcc you can force inline with the __attribute((always_inline)).

    Example:

     /* Prototype.  */
     inline void foo (const char) __attribute__((always_inline));
    

    Source:GCC inline docs

提交回复
热议问题