- 论坛徽章:
- 0
|
本帖最后由 madoldman 于 2010-11-29 13:37 编辑
似乎在C语言层面,NULL也未必就是(void *)0
KBTiller 发表于 2010-11-26 15:59 ![]()
你确定?
请看StandardC99中6.3.2.3 Pointers一节
3 An integer constant expression with the value 0, or such an expression cast to type
void *, is called a null pointer constant.55) If a null pointer constant is converted to a
pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
to a pointer to any object or function.
4 Conversion of a null pointer to another pointer type yields a null pointer of that type.
Any two null pointers shall compare equal.
55) The macro NULL is defined in <stddef.h> (and other headers) as a null pointer constant; see 7.17. |
|