When is “inline” ineffective? (in C)

前端 未结 12 656
鱼传尺愫
鱼传尺愫 2020-12-09 10:56

Some people love using inline keyword in C, and put big functions in headers. When do you consider this to be ineffective? I consider it s

12条回答
  •  不知归路
    2020-12-09 11:41

    Personally I don't think you should ever inline, unless you have first run a profiler on your code and have proven that there is a significant bottleneck on that routine that can be partially alleviated by inlining.

    This is yet another case of the Premature Optimization Knuth warned about.

提交回复
热议问题