www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/15/09:12:31

Xref: news-dnh.mv.net comp.os.msdos.djgpp:4377
From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: (none)
Date: Sun, 14 Jan 1996 14:40:31 -0800
Organization: &tSftDotIotE
Lines: 21
Message-ID: <30F9865F.3EE61F06@alcyone.com>
References: <DL601F DOT 9B7 AT jade DOT mv DOT net>
NNTP-Posting-Host: newton.alcyone.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii wrote:

> Yes, it *is* better.  ANSI C says that the null pointer (for any type) is
> a zero cast to a pointer to that type, but it doesn't guarantee that the
> bit pattern for the null pointer is all-zero (so that !null_ptr is
> true).  So you could write `if (my_pointer == 0)' (because the compiler
> automatically will cast 0 to the pointer type), but `if (!my_pointer)'
> may not work on some odd architectures.

Are you sure this is the case?  I was under the impression that (!p) was exactly
as equivalent as (p == 0) in the context where p is a pointer.

I have a copy of the standard (actually, an annotated copy -- which I only got
to get my paws on the standard), and I don't see this anywhere.

-- 
Erik Max Francis, &tSftDotIotE && uuwest!alcyone!max, max AT alcyone DOT darkside DOT com
San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
_Omnia quia sunt, lumina sunt._ && GIGO Omega Psi && http://www.spies.com/max/
"Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019