Are there any compilers that IGNORE C++ standard about default inline functions?

前端 未结 5 609
忘了有多久
忘了有多久 2021-01-25 08:17

C++ ISO standard says, that:

\"A function defined within a class definition is an inline function.\"

Are there any compilers that IGNORE th

5条回答
  •  余生分开走
    2021-01-25 08:41

    Compiler's usually inline based on the number of calls to the function, the number of pseudo-instructions in the function, and a bunch of other things. Take a look at the GCC documentation on optimization options for an idea of how it does things. Basically, the inline keyword is just a hint that bumps up the likelihood that the compiler will inline. The actual decision to inline is usually complex.

提交回复
热议问题