Usefulness of the “inline” feature

前端 未结 8 1317
难免孤独
难免孤独 2020-12-06 14:40

There\'s two things about inlining:

  • The inline keyword will be ignored if the compiler determines that the function cannot be inlined.
  • Th
8条回答
  •  没有蜡笔的小新
    2020-12-06 15:12

    Inline is also useful if you want the ability to inline functions from a library. Only by putting the code for the function in the header file (which requires inline), is the compiler able to inline the function. Of course it is still up the the compiler whether to inline the function or not.

提交回复
热议问题