[commit] Properly cast sentinels for concat()

Daniel Jacobowitz drow@false.org
Tue Jul 5 04:23:00 GMT 2005


On Tue, Jul 05, 2005 at 06:34:18AM +0200, Eli Zaretskii wrote:
> > 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.

No, OpenBSD uses 0 rather than (void *) 0.  As the language allows.

-- 
Daniel Jacobowitz
CodeSourcery, LLC



More information about the Gdb-patches mailing list