Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!apple!motcsd!hpda!hpcupt1!hpisod2!decot From: decot@hpisod2.HP.COM (Dave Decot) Newsgroups: comp.lang.c Subject: Re: comma operator Message-ID: <2550097@hpisod2.HP.COM> Date: 2 Aug 89 23:32:43 GMT References: <1989Jul28.174033.12734@jarvis.csri.toronto.edu> Organization: Hewlett Packard, Cupertino Lines: 17 > The comma operator's main legitimate use is in the definition of macros > that are expected to act like function calls but perform actions too > complex for a single (non-comma) expression. Another convenient use of the comma operator is in for loops that vary two variables at once: for (count = 0, p = Head; count < MAX && p != NULL; ++count, p = p->next) { ... } Moving one of the initializations above the for statement and one of the increments into the loop body would eliminate the commas, but would also make the dual nature of the loop less clear. Dave Decot