What is wrong with using inline functions?

后端 未结 12 1269
滥情空心
滥情空心 2020-11-29 01:51

While it would be very convenient to use inline functions at some situations,

Are there any drawbacks with inline functions?

Conclusion:

12条回答
  •  清酒与你
    2020-11-29 02:13

    1. As other people said that inline function can create a problem if the the code is large.As each instruction is stored in a specific memory location ,so overloading of inline function make a code to take more time to get exicuted.

    2. there are few other situations where inline may not work

      1. does not work in case of recursive function.
      2. It may also not work with static variable.
      3. it also not work in case there is use of a loop,switch etc.or we can say that with multiple statements.
      4. And the function main cannot work as inline function.

提交回复
热议问题