On Wed, 6 Nov 2002, Thomas Arp wrote: >From: "George Greer" <greerga@CIRCLEMUD.ORG> >> On Wed, 6 Nov 2002, Thomas Arp wrote: >> >> >May I suggest a small macro to make this easier to read: >> > >> >#define FERRY ferrys[onferrynum] >> >> Use a pointer, such as: >> >> struct ferry_data_thingie *ferry; >> ... >> ferry = &ferrys[onferrynum]; >> if (time_info.hours == ferry->f_time_leave_from_room) { >> >> A #define would make sense if different values could be used in place of >> 'onferrynum', but in this case that's what you're trying to get rid of. >> >I thought onferrynum was some kind of iterator, thus the define. Might've been as I didn't keep track of the entire thread. Even so, the pointer will be cleaner than, for example, what load_zones() does now. Macros that magically use local variables can be surprising, and surprising is bad in programming. -- George Greer greerga@circlemud.org -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT