Liste des Groupes | Revenir à cl c |
On Sat, 6 Jul 2024 14:51:19 +0100, bart wrote:It doesn't tell the full story, as you can have any arbitrary expression of such terms that results in a suitable value:
Using actual zero for a pointer value is crass. This wouldn't work forBut of course this does:
example:
>
char *p = 3;
char *p = 0;
From the C23 spec, I found this footnote in §6.6:
A named constant or compound literal constant of integer type and
value zero is a null pointer constant. A named constant or
compound literal constant with a pointer type and a value null is
a null pointer but not a null pointer constant; it may only be
used to initialize a pointer object if its type implicitly
converts to the target type.
That first sentence is so important, you’d think it would be in the main
text somewhere.
Les messages affichés proviennent d'usenet.