Bruno Haible <br...@clisp.org> writes: > Peter Seebach and Simon Josefsson wrote: >> > Note that NULL could >> > be the same, or it could be already converted to (void *), so it depends on >> > the implementation whether: >> > >> > printf("%p\n", NULL); >> > >> > is legit. (Which means it's not portable...) >> >> Indeed, and a quite realistic example of where this bug hits in practice >> is with the version-etc module where the final NULL needs to be >> explicitly casted to work properly on all systems, e.g.: >> >> version_etc (stdout, "gsasl", p, gsasl_check_version (NULL), >> "Simon Josefsson", (char *) NULL); > > That's true when you consider only ISO C99.
And C89/C90? > But in POSIX, NULL is required to be (void *) 0. See > <http://www.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html> > "The macro shall expand to an integer constant expression with the value 0 > cast > to type void *." Thanks for the reference. /Simon