Link-time optimization and inline

前端 未结 6 877
情话喂你
情话喂你 2020-12-08 16:12

In my experience, there\'s lot of code that explicitly uses inline functions, which comes at a tradeoff:

  1. The code becomes less succinct and somewhat less maint
6条回答
  •  自闭症患者
    2020-12-08 16:51

    1. I don't think the inline keyword affects maintainability, and only barely the succinctness. (opinion)
    2. Sometimes inline can decrease run-time performance : http://www.parashift.com/c++-faq-lite/inline-functions.html#faq-9.3
    3. The compilers are quite smart about inlining, I've heard that Visual Studio ignores them almost completely and decides inlining itself.

    does link-time optimization render manual inlining, obsolete? Not at all, the optimizer that makes the inline keyword nigh-obsolete kicks in way before link-time.

提交回复
热议问题