Question of Ignorance

Wayne A. Christopher faustus at ucbcad.UUCP
Fri May 17 08:28:47 AEST 1985


This discussion has brought up another point -- somebody posted an example
where he casted a lhs, and somebody pointed out that you can't do that.
What I am wondering is, why can't you? There seem to be no semantic problems
involved, and it can be very useful for something like:

#define FREE(ptr)	free(char *) ptr); (char *) (ptr) = (char *) -1;

I have wanted to do this at various times, when I don't want to have
to always cast the argument to FREE and I don't ever want to reference
freed data accidentally... I couldn't think of a decent way to do this
that wouldn't cause compiler warnings about pointers being assigned to
the int -1...

	Wayne



More information about the Comp.lang.c mailing list