From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LVa6n-00032r-2J for qemu-devel@nongnu.org; Fri, 06 Feb 2009 18:27:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LVa6l-00031t-AP for qemu-devel@nongnu.org; Fri, 06 Feb 2009 18:27:40 -0500 Received: from [199.232.76.173] (port=57409 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LVa6k-00031n-U5 for qemu-devel@nongnu.org; Fri, 06 Feb 2009 18:27:38 -0500 Received: from bsdimp.com ([199.45.160.85]:54386 helo=harmony.bsdimp.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LVa6k-0003gt-F0 for qemu-devel@nongnu.org; Fri, 06 Feb 2009 18:27:38 -0500 Date: Fri, 06 Feb 2009 16:25:49 -0700 (MST) Message-Id: <20090206.162549.-896935060.imp@bsdimp.com> Subject: Re: [Qemu-devel] [PATCH] Fix definition of NULL From: "M. Warner Losh" In-Reply-To: <498CA9B6.5080302@mail.berlios.de> References: <498CA9B6.5080302@mail.berlios.de> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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, weil@mail.berlios.de In message: <498CA9B6.5080302@mail.berlios.de> Stefan Weil writes: : Hello, : : the definition of NULL in dyngen-exec.h is correct for C++ : but wrong for C. It results in a compiler warning. : : My patch fixes it. Because Qemu does not support C++, : I just used the C definition and did not try to support : C++, too. Actually, it is correct for C as well. "#define NULL 0" is a perfectly acceptable definition[*]. Your definition is also correct, since there are two valid NULL pointer definitions in 'C'. Which one you use will determine which class of errors you catch, but neither one will catch all errors. which compilers is it generating warnings on and what are the warnings? Warner [*] C9x section 3.2.3 para 3 states: [#3] An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant. with a footnote that says NULL is defined in stddef.h.