2025-03-26 00:02:56 +08:00

779 B
Raw Blame History

#qt

在某个大佬编程的代码中看到Q_NULLPTR查文档查不到它的用处终于在外国论坛看到讲解我觉得最合适的解释如下

Q_NULLPTR is a macro,that is replaced as nullptr if compiler supports c++11 and as NULL (which is replaced as 0)if it doesnt.If you use c++11,you can write nullptr instead; use NULL if you dont.

翻译Q_NULLPTR是一个宏如果编译器支持c++11则替换为NULLPTR如果不支持则替换为NULL替换为0。如果使用c++11则可以编写NULLPTR如果不支持则使用NULL

简单的说编译器支持C++11会变为nullptr不支持变为NULL。所以直接用nullptr就好了。