Re: printf("%p\n", (void *)0);
From: Douglas A. Gwyn (DAGwyn_at_null.net)
Date: 03/09/05
- Next message: Asma: "Re: How to open a word document in C"
- Previous message: Andrey Tarasevich: "Re: CurrentElement->next = CurrentElement->next->next (UNDEFINED?)"
- In reply to: Keith Thompson: "Re: printf("%p\n", (void *)0);"
- Next in thread: Keith Thompson: "Re: printf("%p\n", (void *)0);"
- Reply: Keith Thompson: "Re: printf("%p\n", (void *)0);"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 9 Mar 2005 00:13:18 GMT
Keith Thompson wrote:
> But part of the standard can be read to imply that (void*)0 is not a
> valid value of type "pointer to void".
> 7.1.4p1 says:
That's a misreading. The parenthetical phrase "(such as ...)"
is intended to clarify what is meant by "an invalid value",
not to completely characterize the set of invalid values.
In many function-call contexts a null pointer argument would
indeed be invalid, e.g. when a pointer to an array is specified,
but not in the case of printf("%p",vp), where any well-defined
value is permitted. (A null pointer has a "valid" value.)
> On the other hand, the description of the 'p' specifier doesn't say
> anything about null pointers.
It doesn't have to. A null pointer value with type "pointer to
void" is just one case covered by the fprintf spec, and in this
context it does not have any special properties.
- Next message: Asma: "Re: How to open a word document in C"
- Previous message: Andrey Tarasevich: "Re: CurrentElement->next = CurrentElement->next->next (UNDEFINED?)"
- In reply to: Keith Thompson: "Re: printf("%p\n", (void *)0);"
- Next in thread: Keith Thompson: "Re: printf("%p\n", (void *)0);"
- Reply: Keith Thompson: "Re: printf("%p\n", (void *)0);"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|