C++自定义NULLPTR

惊奇的发现C++中连NULL和nullptr都有区别 NULL和nullptr

根据文章,应当做好NULL和nullptr的兼容工作

翻阅了一下qt的宏定义

#ifdef __GNC__
    #define   CC_GNU    (__GNC__*100+__GNUC_MINOR__)
#endif

#ifdef CC_GNU
   #if CC_GNU >=406
        #define COMPILER_NULLPTR
   #endif
#endif

#ifdef COMPILER_NULLPTR
# define NULLPTR         nullptr
#else
# define NULLPTR         NULL
#endif

猜你喜欢

转载自www.cnblogs.com/Jacket-K/p/9253200.html