MISRA 2012 rule 8.10 static inline

后端 未结 1 1645
伪装坚强ぢ
伪装坚强ぢ 2021-01-22 16:03

Why does MISRA recommends a inline function to be declared with static storage class? While the keyword inline is a hint to compiler to replace all function calls with actual fu

相关标签:
1条回答
  • 2021-01-22 16:31

    MISRA C:2012 gives the rationale for rule 8.10 as:

    Rationale

    If an inline function is declared with external linkage but not defined in the same translation unit, the behaviour is undefined.

    A call to an inline function declared with external linkage may call the external definition of the function, or it may use the inline definition. Although this should not affect the behaviour of the called function, it might affect execution timing and therefore have an impact on a real-time program.

    0 讨论(0)
提交回复
热议问题