From owner-freebsd-standards@FreeBSD.ORG Wed Apr 16 05:57:20 2003 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0995B37B401 for ; Wed, 16 Apr 2003 05:57:20 -0700 (PDT) Received: from falcon.midgard.homeip.net (h76n3fls20o913.telia.com [213.67.148.76]) by mx1.FreeBSD.org (Postfix) with SMTP id 6E4D243FB1 for ; Wed, 16 Apr 2003 05:57:17 -0700 (PDT) (envelope-from ertr1013@student.uu.se) Received: (qmail 12320 invoked by uid 1001); 16 Apr 2003 12:57:15 -0000 Date: Wed, 16 Apr 2003 14:57:15 +0200 From: Erik Trulsson To: Jens Schweikhardt Message-ID: <20030416125715.GA12300@falcon.midgard.homeip.net> Mail-Followup-To: Jens Schweikhardt , lamer@properfucked.net, freebsd-standards@FreeBSD.org References: <200304161249.h3GCntqZ071047@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200304161249.h3GCntqZ071047@freefall.freebsd.org> User-Agent: Mutt/1.5.4i cc: freebsd-standards@FreeBSD.org cc: lamer@properfucked.net Subject: Re: standards/50889: NULL defined as 0 instead of (void *)0 X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Apr 2003 12:57:20 -0000 On Wed, Apr 16, 2003 at 05:49:55AM -0700, Jens Schweikhardt wrote: > Synopsis: NULL defined as 0 instead of (void *)0 > > State-Changed-From-To: open->analyzed > State-Changed-By: schweikh > State-Changed-When: Wed Apr 16 05:38:52 PDT 2003 > State-Changed-Why: > The bug is in your code. Because ISO 9899 explicitly allows NULL to be > defined as 0 (C99 6.3.2.3), any code must take this possibility into > account. If expansion to 0 leads to different semantics than expansion > to (void*)0 then the code must use a cast. Correct. > > I agree, though, that it may be desirable to > #define NULL ((void*)0) Unless you want to use the same definition for both C and C++. In C++ the only valid way of defining NULL is #define NULL 0 because in C++ there is no automatic conversion between "pointer to void" and other pointer types as there is in C. > > http://www.freebsd.org/cgi/query-pr.cgi?pr=50889 > _______________________________________________ > freebsd-standards@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-standards > To unsubscribe, send any mail to "freebsd-standards-unsubscribe@freebsd.org" -- Erik Trulsson ertr1013@student.uu.se