From owner-freebsd-chat Wed Aug 9 23:53: 5 2000 Delivered-To: freebsd-chat@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 64A7D37B64F; Wed, 9 Aug 2000 23:52:56 -0700 (PDT) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id e7A6qrl04226; Wed, 9 Aug 2000 23:52:53 -0700 (PDT) Date: Wed, 9 Aug 2000 23:52:53 -0700 From: Alfred Perlstein To: "Thomas M. Sommers" Cc: Mark Ovens , chat@FreeBSD.ORG Subject: Re: C time functions - problem Message-ID: <20000809235253.O4854@fw.wintelcom.net> References: <20000808201807.H250@parish> <20000808122832.I4854@fw.wintelcom.net> <39908B06.D1238928@mail.ptd.net> <20000809150804.L4854@fw.wintelcom.net> <39923E04.94A1B30E@mail.ptd.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.4i In-Reply-To: <39923E04.94A1B30E@mail.ptd.net>; from tms2@mail.ptd.net on Thu, Aug 10, 2000 at 01:30:44AM -0400 Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org * Thomas M. Sommers [000809 22:31] wrote: > Alfred Perlstein wrote: > > > > * Thomas M. Sommers [000808 17:46] wrote: > > > Alfred Perlstein wrote: > > > > > > > > Don't cast 0 to a pointer type, use NULL. > > > > > > Or just use 0. > > > > Not if you want me to accept the code. > > According to the (draft) standard, section 6.3.2.3: > > "An integer constant expression with the value 0, or such an expression > cast to type void *, is called a null pointer constant. If a null > pointer constant is converted to a pointer type, the resulting pointer, > called a null pointer, is guaranteed to compare unequal to a pointer to > any object or function." > > There are very few circumstances in which you need to cast 0 to make it > a null pointer constant. That's not the point, the point is if you want _me_ to accept the code you better be using 0/NULL/'\0' like so: char x = '\0'; int *y = NULL; int z = 0; If you want to run code that does it a different way past someone else that's fine by me. I was merely stating my preference on the correct usage of NULL/0/nul. -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message