Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!uwm.edu!uakari.primate.wisc.edu!ames!uhccux!munnari.oz.au!mimir!hugin!augean!sirius!nt!levels!ccdn From: CCDN@levels.sait.edu.au (DAVID NEWALL) Newsgroups: comp.lang.c Subject: Re: effect of free() Message-ID: <1641@levels.sait.edu.au> Date: 14 Sep 89 14:47:43 GMT References: <319@cubmol.BIO.COLUMBIA.EDU> <3756@buengc.BU.EDU> <10988@smoke.BRL.MIL> <9339@attctc.Dallas.TX.US> Organization: Sth Australian Inst of Technology Lines: 25 In article <10988@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn) writes: > In article <1465@levels.sait.edu.au> CCDN@levels.sait.edu.au (DAVID NEWALL) writes: > >a machine that *did* trap in such a case, would be decidedly unfriendly. > > while letting you continue to play with pointers that point absolutely > nowhere would be friendly?? I think you're looking at this from the wrong angle. Don't ask why it would be friendly to allow invalid pointers (remember that I'm not talking about dereferencing of invalid pointers), ask instead why it would be unfriendly to disallow it. I can think of a few reasons why one might legitimately want to process such a pointer. In fact, the definitions for SIG_DFL and SIG_IGN would seem to be excellent examples of this: #define SIG_DFL (int (*)())0 #define SIG_IGN (int (*)())1 I have a philosophy which I am going to share with you: Avoid unnecessary restrictions. Is it truly necessary that one not be able to *look* at a pointer without first knowing that it is valid? I claim that it is not. David Newall Phone: +61 8 343 3160 Unix Systems Programmer Fax: +61 8 349 6939 Academic Computing Service E-mail: ccdn@levels.sait.oz.au SA Institute of Technology Post: The Levels, South Australia, 5095