effect of free()

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Sep 21 05:46:38 AEST 1989


In article <125 at bbxsda.UUCP> scott at bbxsda.UUCP (Scott Amspoker) writes:
>...  This is where you forbid somebody from doing something not
>because it is wrong but because you believe it could eventually *lead* to
>something wrong.

Nobody is "forbidding" you to continue to access pointers after
they're free()d.  We're pointing out that it's not portable to do so.

>Nobody wants to be told that their well-written code will suddenly fail.

Nobody wants to hear that all the world's not a VAX, either..

I agree that there is a market issue here.  However, if you really
want to strive for widest availability of your software product,
it behooves you to pay attention to these portability matters.
Otherwise, your product will be confined to environments not too
dissimilar to the specific one that you assumed as a model.

It's not very hard to factor in the notion that a pointer is "poison"
when it no longer points to valid storage.  One would think that
"well-written code" would already follow that model, which is
compatible with a wider range of environments.



More information about the Comp.lang.c mailing list