When do compilers inline C++ code?

前端 未结 11 1191
孤独总比滥情好
孤独总比滥情好 2020-11-29 08:07

In C++, do methods only get inlined if they are explicitly declared inline (or defined in a header file), or are compilers allowed to inline methods as they see

11条回答
  •  伪装坚强ぢ
    2020-11-29 08:49

    Compilers might inline any function or might not inline it. They are allowed to use the inline decoration as a hint for this decision, but they're also allowed to ignore it.

    Also note that class member functions have an implicit inline decoration if they are defined right in the class definition.

提交回复
热议问题