Path: utzoo!attcan!uunet!husc6!bbn!uwmcsd1!ig!agate!ucbvax!pasteur!ic.Berkeley.EDU!faustus From: faustus@ic.Berkeley.EDU (Wayne A. Christopher) Newsgroups: comp.lang.misc Subject: Re: Modern languages (Slight return) Message-ID: <3631@pasteur.Berkeley.Edu> Date: 24 May 88 22:03:54 GMT References: <2031@uoregon.uoregon.edu> <3292@enea.se> <2414@uvacs.CS.VIRGINIA.EDU> <2096@ur-tut.UUCP> Sender: news@pasteur.Berkeley.Edu Lines: 26 In article <2031@uoregon.uoregon.edu>, markv@uoregon.uoregon.edu (Mark VandeWettering) writes: > Uses of the cpp should be: > 3. Hide awkward dereferencing of nested pointer structures, > esp complicated unions.... Another use that's related to this is replacing things like for (ptr = stuff->things; ptr != NULL; ptr = ptr->next) with foreach_thing(stuff, ptr) This has the advantage of hiding the representation of the set, so that if you change it to a hash table or an array you needn't change all your code. I think it's pretty obvious what it does, even though it does modify the syntax. Of course, it goes without saying that #define WHILE(s) while (s) { #define ELIHW } is an evil thing... Wayne