2011年10月27日

#define _FARQ的解释

摘要: 看到这样一段代码:template<class_Ty> inline _Ty _FARQ *_Allocate(_SIZT _Count, _Ty _FARQ *){ //check for integer overflow if(_Count <= 0) _Count = 0; else if(((_SIZE)(-1)/_Count) < sizeof(_Ty)) _THROW_NCEE(std::bad_alloc, NULL); //allocate storage for _Count elements of type _Ty return((_Ty _FARQ 阅读全文

posted @ 2011-10-27 14:59 LateStop 阅读(5684) 评论(0) 推荐(1)

#define与typedef的区别

摘要: 1) #define是预处理指令,在编译预处理时进行简单的替换,不作正确性检查,不关含义是否正确照样带入,只有在编译已被展开的源程序时才会发现可能的错误并报错。例如:#define PI 3.1415926程序中的:area=PI*r*r 会替换为3.1415926*r*r如果你把#define语句中的数字9 写成字母g 预处理也照样带入。2)typedef是在编译时处理的。它在自己的作用域内给一个已经存在的类型一个别名,但是You cannot use the typedef specifier inside a functiondefinition。3)typedef int * int_ 阅读全文

posted @ 2011-10-27 14:43 LateStop 阅读(274) 评论(0) 推荐(0)

导航