#define MAX(a,b) ((a)>(b)?(a):(b))


要点:变量都用括号括起来,防止出错,结尾不需要;。在实际编程中,不推荐把复杂的函数使用宏,不容易调试。多行用\



#define CREATE_FUNC_TYPE(__TYPE__,__PARAM__) \
static __TYPE__* create(__PARAM__ para) \
{ \
__TYPE__ *pRet = new(std::nothrow) __TYPE__(); \
if (pRet && pRet->init(para)) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}