Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: effect of free() Message-ID: <10985@smoke.BRL.MIL> Date: 9 Sep 89 00:51:10 GMT References: <319@cubmol.BIO.COLUMBIA.EDU> <3756@buengc.BU.EDU> <1989Aug17.005548.745@twwells.com> <16022@vail.ICO.ISC.COM> <248@seti.inria.fr> <1010@m3.mfci.UUCP> <10973@smoke.BRL.MIL> <247@bbxeng.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 In article <247@bbxeng.UUCP> scott@bbxeng.UUCP (Scott-Engineering) writes: >In other words - you cannot even *test* a pointer unless you are *sure* >there is a valid address in it. I don't think so. There is no way a strictly conforming C program can create an invalid pointer value, apart from free()ing a valid one that it got from malloc() or realloc(). The moment an improper pointer value is created via arithmetic operations, the program has violated the guarantees of the Standard, and the implementation would be free to trap immediately. >Is NULL some kind of special exception? Yes, as has been mentioned many times previously, null pointers (and null pointer constants, not the same thing!) are special critters with their own unique rules.