TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Rob Swindell
from: Rob Swindell
date: 2003-09-11 16:06:28
subject: NULL

Re: NULL
  By: Rob Swindell to Torfs Tom on Thu Sep 11 2003 03:40 pm

 >  > which leads to the conclusion that
 >  > 	if(!p)	is equivalent to	if(p == 0)
 > 
 > The FAQ is wrong on this question. There is no "internal
representation of a
 > null pointer" as far as the compiler is concerned.
 > 
 > The C Library (and the stddef.h header file) determine the value of NULL. So
 > for example, the C Library used -1 for NULL:
 > 
 >         if(p)
 > 
 > is *not* equivalent to:
 > 
 >         if(p!=NULL)

Well apparently, if p is indeed a pointer, my assertion is incorrect. I was not
aware that ANSI put such requirements on a compiler (to dynamically change any
pointer to 0 to the internal value used on the target archtitecture to
represent an invalid address).

http://www.eskimo.com/~scs/C-faq/q5.5.html

So apparently, you're safe to assume that NULL will always be 0.

And if you actually want to access address 0, then you'll need to use an
integer (instead of a pointer) or use some other language. :-)

Wierd, eh?

                                                  digital man

Snapple "Real Fact" #22:
Alaska has the highest percentage of people who walk to work.
--- SBBSecho 2.00-Win32
* Origin: Vertrauen - vert.synchro.net (1:103/705)
SEEN-BY: 633/267 270
@PATH: 103/705 218/903 10/3 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.