[gclist] C realloc/free semantics with conservitave GC.

Richard A. O'Keefe ok@cs.rmit.edu.au
Mon, 3 Jun 1996 13:32:17 +1000 (EST)


	This allows the ugly but official
		for (p = root; p; p = p->next)
			free(p);

I don't understand.  What do you mean "official"?  This is not legal
standard C.  In fact, even

	for (p = root; p; p = q) {
	    q = p->next;
	    free(p);
	    assert(p != NULL);			/* <- here */
	}

is illegal.  In standard C, as soon as you have free()d a pointer,
_any mention_ of that pointer value (whether derived from that variable
or another) is illegal.