- 论坛徽章:
- 95
|
to407 发表于 2014-03-17 16:04
回复 41# MMMIX
对照 C99 标准看了一下原书的内容,那个 NULL 的定义并没有问题:
1. 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.66) 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.
2. 66)
The macro NULL is defined in <stddef.h> (and other headers) as a null pointer constant; see 7.19.
可见 NULL 需要被扩展为一个 null pointer constant,而 (void *)0 本身就是一个 null pointer constant. |
|