From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28041 invoked by alias); 5 Jul 2005 03:34:34 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 28006 invoked by uid 22791); 5 Jul 2005 03:34:26 -0000 Received: from legolas.inter.net.il (HELO legolas.inter.net.il) (192.114.186.24) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 05 Jul 2005 03:34:26 +0000 Received: from HOME-C4E4A596F7 (IGLD-83-130-203-139.inter.net.il [83.130.203.139]) by legolas.inter.net.il (MOS 3.5.8-GR) with ESMTP id EUX14396 (AUTH halo1); Tue, 5 Jul 2005 06:34:19 +0300 (IDT) Date: Tue, 05 Jul 2005 03:34:00 -0000 Message-Id: From: Eli Zaretskii To: Mark Kettenis , gdb-patches@sourceware.org In-reply-to: <20050704225153.GA31424@nevyn.them.org> (message from Daniel Jacobowitz on Mon, 4 Jul 2005 18:51:53 -0400) Subject: Re: [commit] Properly cast sentinels for concat() Reply-to: Eli Zaretskii References: <200507041336.j64Da5cE001221@jop31.nfra.nl> <20050704225153.GA31424@nevyn.them.org> X-SW-Source: 2005-07/txt/msg00056.txt.bz2 > Date: Mon, 4 Jul 2005 18:51:53 -0400 > From: Daniel Jacobowitz > Cc: Mark Kettenis , 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.