Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!van-bc!rsoft!mindlink!a218 From: a218@mindlink.UUCP (Charlie Gibbs) Newsgroups: comp.sys.amiga Subject: Re: Dynamic Memory Allocation Message-ID: <1177@mindlink.UUCP> Date: 20 Feb 90 20:46:58 GMT Organization: MIND LINK! - British Columbia, Canada Lines: 29 [Various discussions as to the legality of such constructs as > for(s=head; s != NULL; s=s->next) free(s); deleted] Why take a chance? Being a "belt and suspenders" man myself, I prefer something like this: s = head; while (s != NULL) { x = s; s = s->next; free (x); } A bit of extra work, perhaps, but it's guaranteed to work even if the OS designer had a bad day. Of course, I'm the type who uses lots of extra parentheses just to play it safe, e.g. if ((x == a) && (y == b)) which won't break if I change the expressions. -- Charlie_Gibbs@mindlink.UUCP If you're not part of the solution, you're part of the precipitate.