Path: utzoo!attcan!uunet!aplcen!samsung!cs.utexas.edu!mailrus!ncar!boulder!stan!dancer!imp From: imp@dancer.Solbourne.COM (Warner Losh) Newsgroups: comp.lang.c++,apple.general Subject: Re: Failed allocation in constructors? Message-ID: <1990Jul11.180345.21464@Solbourne.COM> Date: 11 Jul 90 18:03:45 GMT References: <9075@goofy.Apple.COM> <42825@apple.Apple.COM> Sender: news@Solbourne.COM Organization: Solbourne Computer, Inc. Lines: 19 In article <42825@apple.Apple.COM> fair@Apple.COM (Erik E. Fair) writes: >So, dereferencing zero isn't a bad thing; it's just bad to assume that >you always can across all possible hardware architectures that your >program might be run on. Dereferencing "zero" is a bad thing. "0" is the Nil pointer in C and C++. It is defined to point to an address that doesn't exist (or is at least unique). So if you dereference it, you are asking for trouble. In most implementations of C and C++ a Nil pointer has all its bits turned off, but not all implementations do this. Regardless of the implementation, saying "p=0" will get you a Nil pointer. So if you then say *p, that is an error. However, according to the standard, compilers are free to not notify the user this error has occurred. -- Warner Losh imp@Solbourne.COM All the world is not a VAX. :-)