c++ 用宏定义一个函数
时间:2015-09-22 11:30:57
收藏:0
阅读:650
#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; } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/fox64194167/article/details/48651543
评论(0)