Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!milano!cadillac!pebbles!ned From: ned@pebbles.cad.mcc.com (CME Ned Nowotny) Newsgroups: comp.unix.wizards Subject: Re: Referencing NULL pointers Message-ID: <1789@cadillac.CAD.MCC.COM> Date: 18 Jul 89 20:16:47 GMT References: <32UP02Eg3d=801@amdahl.uts.amdahl.com> <1382@bruce.OZ> <1759@cadillac.CAD.MCC.COM> <18612@mimsy.UUCP> Sender: news@cadillac.CAD.MCC.COM Reply-To: ned%cad@MCC.COM (CME Ned Nowotny) Organization: MCC CAD Program, Austin, TX Lines: 39 In article <18612@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: =>In article <1759@cadillac.CAD.MCC.COM> ned@pebbles.cad.mcc.com (CME =>Ned Nowotny) writes: =>>The argument over whether or not a C compiler should allow dereferencing =>>of 0 (NULL) or any other numeric constant purporting to be an address is =>>unrelated to the question of portability. => =>Actually, it is related, other than in the obvious way (the result of => => *(sometype *)(some integer expression) => =>is never portable). The peculiar thing is that, even on machines =>where location 0 is addressible and has something there (e.g., restart =>and interrupt vectors), the expression => => *(char *)0 => =>might get you something from somewhere other than location 0. ...A good example deleted... Fair enough. In fact, I would agree that it is never a good idea to bind an object to a specific address by assigning a numeric constant (or integer variable) to a pointer variable within a C program. It is much better to manipulate objects through symbolic names. Of course, this requires a good link editor that includes the ability to bind symbolic names to absolute addresses. The System V link editor did provide this capability, but it is baroque and flawed in other ways. Does anyone know what, if anything, UI and OSF are doing about the UNIX link editors they will be providing? Ned Nowotny, MCC CAD Program, Box 200195, Austin, TX 78720 Ph: (512) 338-3715 ARPA: ned@mcc.com UUCP: ...!cs.utexas.edu!milano!cadillac!ned ------------------------------------------------------------------------------- "We have ways to make you scream." - Intel advertisement in the June 1989 DDJ.