摘要:
1. 宏可以像函数一样被定义,例如:#define min(x,y) (x 但是在实际使用时,只有当写上min(),必须加括号,min才会被作为宏展开,否则不做任何处理。2. 如果宏需要参数,你可以不传,编译器会给你警告(宏参数不够),但是这会导致错误。如C++书籍中所描述的,编译器(预处理器)对宏的语法检查不够,所以更多的检查性工作得你自己来做。3. 很多程序员不知道的#和###符号把一个符号直接转换为字符串,例如:#define STRING(x) #xconst char *str = STRING( test_string ); str的内容就是"test_string&qu 阅读全文
摘要:
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzarg%2Fvariable_length_arrays.htmAflexible array memberis permitted as the last element of a structure even though it has incomplete type, provided that the structure has more than one named member. A flexible array member is a C99 阅读全文
摘要:
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzarg%2Fvariable_length_arrays.htmVariable length arrays (C++ only)A variable length array, which is a C99 feature, is an array of automatic storage duration whose length is determined at run time.Variable length array declarator sy 阅读全文
摘要:
In astructwith more than one member, the last member of thestructcan have incomplete array type. Such a member is called aflexible array memberof thestruct.NoteWhen astructhas a flexible array member, the entirestructitself has incomplete type.Flexible array members enable you to mimic dynamic type 阅读全文
摘要:
Returns NARG, the number of arguments contained in __VA_ARGS__ beforeexpansion as far as NARG is >0 and <64 (cpp limits):#define PP_RSEQ_N() 63,62,61,60,[..],9,8,7,6,5,4,3,2,1,0#define PP_ARG_N(_1,_2,_3,_4,_5,_6,_7,_8,_9,[..],_61,_62,_63,N,...) N#define PP_NARG_(...) PP_ARG_N(__VA_ARGS__)#defi 阅读全文