Benefits of declaring a function as “inline”?

前端 未结 10 1885
天涯浪人
天涯浪人 2020-12-09 14:01

Every time I read about the \"inline\" declaration in C it is mentioned that it is only a hint to the compiler (i.e. it does not have to obey it). Is there any benefit to ad

10条回答
  •  轮回少年
    2020-12-09 14:17

    Compilers are smart, but can still benefit from hints from the developer. If you think some of your functions in particular should be inlined, then declare them as such. It certainly doesn't hurt.

提交回复
热议问题