On Sun, 5 Jul 1998, Mundi King wrote: > for (i=object_list; i; i=->next) > { > extract_obj(i); > } > > compared to > point_update in limits.c > > for(j = object_list;j;j = next_thing) { > next_thing = j->next; > > extract_obj(j); > } The second method is the "correct" way to loop through a linked list when dealing with ANY LINKED LIST (descriptor_list, character_list, object_list, etc.) NOTE: "correct" means the safest way. The first way works, but if you ever extract obj and then attempt to access obj->next, guess what is going to happen? John Evans <evansj@datawest.net> AKA: Zeavon http://www.hi-line.net/~evansj/ telnet://spear.gator.net:1066 Any sufficiently advanced technology is indistinguishable from magic. --Arthur C. Clarke I find planning for the future allows one to delay acting in the present. --Chris England +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST