From owner-freebsd-chat Thu Aug 10 10:51:44 2000 Delivered-To: freebsd-chat@freebsd.org Received: from happy.checkpoint.com (happy.checkpoint.com [199.203.156.41]) by hub.freebsd.org (Postfix) with ESMTP id 741E437B685 for ; Thu, 10 Aug 2000 10:51:37 -0700 (PDT) (envelope-from mellon@pobox.com) Received: (from mellon@localhost) by happy.checkpoint.com (8.9.3/8.9.3) id UAA13332; Thu, 10 Aug 2000 20:52:35 +0300 (IDT) (envelope-from mellon@pobox.com) Date: Thu, 10 Aug 2000 20:52:35 +0300 From: Anatoly Vorobey To: David Scheidt Cc: "Thomas M. Sommers" , chat@freebsd.org Subject: Re: C time functions - problem Message-ID: <20000810205235.A13316@happy.checkpoint.com> References: <20000810191221.A12280@happy.checkpoint.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: ; from dscheidt@enteract.com on Thu, Aug 10, 2000 at 12:46:17PM -0500 Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Thu, Aug 10, 2000 at 12:46:17PM -0500, David Scheidt wrote: > On Thu, 10 Aug 2000, Anatoly Vorobey wrote: > > :On Thu, Aug 10, 2000 at 01:30:44AM -0400, Thomas M. Sommers wrote: > :> > :> "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. > : > :I am not aware of any such circumstances at all. 0 can always be used > :instead of NULL, and, since I find it completely unambiguous, I always > :use 0 for null pointers. > > This is only true on systems where 0 is not a valid address. On such > systems, NULL pointers aren't equal to 0. This is incorrect. The underlying representation of the NULL pointer is totally irrelevant. The compiler treats the integer constant 0 as the null pointer, and the programmer should never worry about how the null pointer is actually represented. Thus comparing a pointer with 0 will always test it for being a null pointer, regardless of how null pointer is represented on the particular architecture. See the standard or a FAQ for more details. -- Anatoly Vorobey, mellon@pobox.com http://pobox.com/~mellon/ "Angels can fly because they take themselves lightly" - G.K.Chesterton To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message