使用宏时须注意:
- 参数两边要加括号
- 整个表达式两边要加括号
- 特别注意表达式多次求值的情况,如 max(++i, j)
- 宏会搅乱名字空间
- 宏不能递归
- 宏没有地址
- 宏不利于调试
On a compliant compiler, it is not possible for a macro to create any of the following:
a trigraph (trigraphs are replaced in phase 1);
a universal character name (\uXXXX, replaced in phase 1);
an end-of-line line-splicing backslash (replaced in phase 2);
a comment (replaced in phase 3);
another macro or preprocessing directive (expanded and executed in phase 4); or
changes to a character literal (for example, 'x') or string literal (for example, "hello, world") via macro names inside the strings.
文章来源:
http://my.donews.com/robinchow/2007/02/11/bavcdirqeacybkdedpxorhuddpwyehtghojl/