Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!mips!apple!fair From: fair@Apple.COM (Erik E. Fair) Newsgroups: comp.lang.c++,apple.general Subject: Re: Failed allocation in constructors? Message-ID: <42825@apple.Apple.COM> Date: 11 Jul 90 08:48:56 GMT References: <9075@goofy.Apple.COM> Organization: USENET Protocol Police, Western Gateway Division Lines: 27 In the referenced article, escher@Apple.COM (Michael Crawford) writes: on Unix, it should core dump (if page 0 is mapped out, as good Unices do). Mike, Deferencing address zero isn't a crime, unless it isn't in your address space. There are lots of versions of UNIX where it is, and that program won't crash and burn until you reach the bottom of your allocated address space. The reason that some UNIX systems don't map page zero, as you put it, varies. Some do it because their hardware (or compiler) has things set up so that a user program's address space doesn't begin in zero. Some do it, because attempting to deference address zero is a very common portability error (and more than occasionally, a logic error) for the systems that don't have it mapped, particularly for those programs which assume that location zero *contains* a zero of some size. So some UNIX systems that might otherwise have address zero mapped, don't do so, as an encouragement to write portable code. 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. Erik E. Fair apple!fair fair@apple.com