comma operator
Paul De Bra
debra at alice.UUCP
Fri Aug 4 23:25:07 AEST 1989
In article <13074 at megaron.arizona.edu> robert at arizona.edu (Robert J. Drabek) writes:
}...
}I agree with you. The one place, though, where it is used is in "for"
}loops: for (i = 0, j = 9; ...; i++, j--)
}
}I have seen the following "attempt" at using a comma operator in a function
}call:
}
} func(expr1, expr2)
}
}The writer thought he was using the comma operator since the function
}had been defined as having a single argument. He did get
>
} func((expr1, expr2))
}
}to work. I don't know if all compilers would get this, though.
The following is also a problem:
if i have something like
if (e)
return;
and want to get some debug output, i would try
if (e)
printf("Hi\n"),return;
but this gives syntax error. (at least in the compilers i've tried)
Note that
if (e)
printf("Hi\n"),exit();
compiles fine. It's just that "return" is treated differently.
Paul
--
------------------------------------------------------
|debra at research.att.com | uunet!research!debra |
------------------------------------------------------
More information about the Comp.lang.c
mailing list