TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Kurt Kuzba
from: Rob Swindell
date: 2003-09-10 14:26:20
subject: Pointers

Re: Pointers
  By: Kurt Kuzba to All on Mon Sep 08 2003 03:00 am

 >     True.  The standard only says that there will be a value
 >  called NULL, which will be defined in a macro which will be
 >  found in the stddef.h file.  It does not specify what value
 >  will be specified by NULL.  It is generally zero, and I have
 >  never heard of it being anything else, but still, implementation
 >  defined is implementation defined, and not a strict standard.
 >  There may be further changes to the standard which define NULL
 >  as being equal to zero, but that has no bearing on anybody doing
 >  development work on an older compiler which predates any change
 >  in the standard.  I would consider defining NULL as anything
 >  other than zero as human error, which puts it right in the midst
 >  of the realm of possibilities.  :)

NULL will always be zero... until it's not. :-)

Seriously, there maybe an architecture some day that addresses memory in such a
way where 0 is a preferrable heap address, so NULL would need to be defined as
-1 or some other illegal heap address.

So, when testing pointers, don't use boolean tests, always test for ==/!=NULL.

                                                  digital man

Snapple "Real Fact" #105:
You will burn 7% more calories walking on hard dirt than pavement.
--- 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™.