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

 

posted @ 2018-07-02 11:59  _离水的鱼  阅读(200)  评论(0编辑  收藏  举报