Will C++ linker automatically inline functions (without “inline” keyword, without implementation in header)?

前端 未结 8 1262
余生分开走
余生分开走 2021-02-07 06:42

Will the C++ linker automatically inline \"pass-through\" functions, which are NOT defined in the header, and NOT explicitly requested to be \"inlined\" through the

8条回答
  •  渐次进展
    2021-02-07 07:42

    Yes, any decent compiler is fully capable of inlining that function if you have the proper optimisation flags set and the compiler deems it a performance bonus.

    If you really want to know, add a breakpoint before your function is called, compile your program, and look at the assembly. It will be very clear if you do that.

提交回复
热议问题