Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!xanth!kremer From: kremer@cs.odu.edu (Lloyd Kremer) Newsgroups: comp.lang.c Subject: Re: Referencing NULL pointers Message-ID: <9838@xanth.cs.odu.edu> Date: 28 Aug 89 19:09:10 GMT References: <32UP02Eg3d=801@amdahl.uts.amdahl.com> <1382@bruce.OZ> <10830@smoke.BRL.MIL> Organization: Old Dominion University, Norfolk, Va. Lines: 26 In article <10830@smoke.BRL.MIL> gwyn@smoke.BRL.MIL (Doug Gwyn) writes: >The compiler is entirely at liberty to IMMEDIATELY >turn (whatever*)0 into an internal form such as (&__nullity), where >__nullity is part of the C library. If you were able to dereference >such a "0-valued" pointer, in fact you'd access __nullity, not address 0. >Therefore you'd better not have anything at address 0 that really needs >to be accessed from C code. This is true for integral constant 0, but could you not access memory location 0 by writing: int data, p; p = 0; /* integer variable that happens to be set to zero */ data = *(int *)p; /* no constant expression in this line */ I would think the "promotion to nil pointer" rule would not apply here. -- Lloyd Kremer ...!uunet!xanth!kremer Have terminal...will hack!