Re: [commit] Properly cast sentinels for concat()

Eli Zaretskii
2005-07-05T03:34:34Z

> Date: Mon, 4 Jul 2005 18:51:53 -0400
> From: Daniel Jacobowitz <drow@false.org>
> Cc: Mark Kettenis <kettenis@jive.nl>, gdb-patches@sourceware.org
>
> You must cast NULL to a pointer type if you use it as the sentinel in a
> varargs list, in portable code, because 0 is a legal definition of NULL
> (according to the C standard, which is quite clear on the subject). On
> an I32 LP64 system, passing 0 to a varargs function may take 32 bits on
> the stack while passing NULL takes 64 bits.

But in Mark's case, NULL is defined as (void *)0, so it's a pointer,
not an int.

> Even more C++ implementations use 0, which makes the problem even
> worse. ISTR that (void *)0 is not an acceptable definition of NULL in
> C++.

We are not talking about C++ code here, nor about a C++ compiler.