迷路的龙猫

Hacking the interesting world!

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

英文标题(Prefer consts, enums, and inlines to #defines)

理由:

①使用宏定义常量的过程中,出错的时候难以调试,宏的常量在编译时不进入符号表。

②使用宏定义的函数功能,极容易出现错误的期待结果。

 

Things to remember:

1.for simple constants, prefer const objects or enums to #define.

对于一般的常量,尽量使用const对象或者枚举,而不用宏。

2.For function-like macros, prefer inline functions to #define.

对于类似函数的宏,尽量使用内联函数。

posted on 2014-03-27 22:22  迷路的龙猫  阅读(225)  评论(0编辑  收藏  举报