comma operator: keep away?
Lloyd Kremer
kremer at cs.odu.edu
Tue Apr 25 02:00:55 AEST 1989
In article <19913 at iuvax.cs.indiana.edu> bobmon at 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!
More information about the Comp.lang.c
mailing list