inline function内联函数

macro宏

You should use an inline function when you wish to optimize function calls. You may consider an inline function as a macro that copies the function contents (inline) to code segment where the function is called. However, inline function is very different from a macro (google it up). Some major differences:

  1. Inline function is type safe
  2. It is up to the compiler to choose to inline the inline function or not
  3. Expression passed to inline functions are evaluated exactly once

Functions defined in the class definition are also inline although there is no explicit inline directive.

 

posted on 2012-10-18 16:40  Zaiping  阅读(275)  评论(0编辑  收藏  举报