Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IrGwU-0000LL-FG for qemu-devel@nongnu.org; Sun, 11 Nov 2007 12:49:54 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IrGwR-0000Ji-O6 for qemu-devel@nongnu.org; Sun, 11 Nov 2007 12:49:53 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IrGwR-0000JW-Ji for qemu-devel@nongnu.org; Sun, 11 Nov 2007 12:49:51 -0500 Received: from mx2.suse.de ([195.135.220.15]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IrGwR-0007kl-50 for qemu-devel@nongnu.org; Sun, 11 Nov 2007 12:49:51 -0500 From: Andreas Schwab Subject: Re: [Qemu-devel] error compiling hw/sh7750.c References: <20071111093026.NJ0KX.29116.root@eastrmwml27.mgt.cox.net> <20071111160634.GF25322@tapir> <20071111172122.GA9387@tapir> Date: Sun, 11 Nov 2007 18:49:47 +0100 In-Reply-To: <20071111172122.GA9387@tapir> (Carlo Marcelo Arenas Belon's message of "Sun\, 11 Nov 2007 11\:21\:22 -0600") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Carlo Marcelo Arenas Belon writes: > and run a test, the problem is in /usr/include/iso/stdio_iso.h that def= ined > NULL as an int and not a pointer as shown by : NULL is not a pointer, it is a null pointer constant, and 0 is a valid null pointer constant. > contradicting (at least in spirit) the C99 (ISO/IEC 9899:TCS) standard = that > says : > > "A pointer to void shall have the same representation and alignment=20 > requirements as a pointer to a character type" A null pointer constant is not a pointer. It can be convert to a pointer, but that happens only in the right context (through explicit or implicit conversions). > and therefore makes sizeof(*NULL) =3D=3D 1 solving the problem to compi= le as it is > done if applying the following patch : > > Carlo > > --- > --- qemu/hw/sh7750.c Sun Oct 7 09:31:11 2007 > +++ qemu/hw/sh7750.c Sun Nov 11 16:13:13 2007 > @@ -29,6 +29,9 @@ > #include "sh7750_regnames.h" > #include "sh_intc.h" > =20 > +#undef NULL > +#define NULL ((void *)0) This does not make it better, since sizeof(void) is still not allowed in C. Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany PGP key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED= 5 "And now for something completely different."