本文介绍了在C ++中使用NULL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C ++中使用NULL还是仅使用值0是一个好主意?

Is it a good idea to use NULL in C++ or just the value 0?

在从C ++调用的C代码中使用NULL的特殊情况?像SDL吗?

Is there a special circumstance using NULL in C code calling from C++? Like SDL?

推荐答案

在C ++中,NULL扩展为0或0L。请参见:

In C++ NULL expands to 0 or 0L. See this comment from Stroustrup:

如果必须命名空指针,则
则将其命名为nullptr;这就是在C ++ 0x中将其称为
的原因。然后,
nullptr将成为关键字。

If you have to name the null pointer, call it nullptr; that's what it's going to be called in C++0x. Then, "nullptr" will be a keyword.

这篇关于在C ++中使用NULL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 15:06
查看更多