comma operator
Robert J. Drabek
robert at arizona.edu
Fri Aug 4 02:51:39 AEST 1989
In article <918 at helios.toronto.edu>, dooley at helios.toronto.edu (Kevin Dooley) writes:
>
> Can anybody tell me if there is a usage where the comma is 'better'.
> By this I mean are there any places where using a comma makes the
> code more readable, efficient, produce cleaner/faster assembler (I
> know this is compiler dependant). It's just that I've never seen a
> program with the comma operator where I didn't scream and edit it out.
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.
--
Robert J. Drabek
Department of Computer Science
The University of Arizona
Tucson, AZ 85721
More information about the Comp.lang.c
mailing list