inline(读书笔记)

来源:互联网 发布:怎么样联系网络推手 编辑:程序博客网 时间:2024/05/21 09:27
inline is a new characteristic in the C++ language. The compiler will check the type of it, if there is not error, the code of the inline function will be put where it is invoked. While the #define macro is processed by the preprocessor, which would not check the type.
      There two restriction:
      1, The inline fuction is too complex, e.g. has loop setences.
      2, The function address is needed explicitly or inexplicitly.
      In this case, the complier will drop the inline, and treat as the common function.
  The inline function is often defined    in the head file, and is treated as static function in those files which inlude this head file, make it local to avoid re-defined errors.
原创粉丝点击