Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!xanth!kremer From: kremer@cs.odu.edu (Lloyd Kremer) Newsgroups: comp.lang.c Subject: Re: comma operator: keep away? Summary: Sometimes it's handy Message-ID: <8611@xanth.cs.odu.edu> Date: 24 Apr 89 16:00:55 GMT References: <19913@iuvax.cs.indiana.edu> Organization: Old Dominion University, Norfolk, Va. Lines: 35 In article <19913@iuvax.cs.indiana.edu> bobmon@iuvax.cs.indiana.edu (RAMontante) writes: >Is there a circumstance in which the comma operator is required, where >the compound statement cannot be broken into multiple statements? Perhaps not required, but convenient nevertheless. I often use it for loop tests using functions that "get" information but do not "return" the information they get. For example: extern double frexp(); double f[SIZE]; int i, exp; ... while(frexp(f[i++], &exp), exp < 10) statement; ... Another example would be: char c; while(read( ..., &c, 1), c != '\n') assuming EOF detection is not needed for this read() (horrible assumption, I know). -- Lloyd Kremer Brooks Financial Systems ...!uunet!xanth!brooks!lloyd Have terminal...will hack!