comma operator

Kevin Dooley dooley at helios.toronto.edu
Tue Aug 1 00:06:51 AEST 1989


In article <1989Jul28.174033.12734 at jarvis.csri.toronto.edu> flaps at dgp.toronto.edu (Alan J Rosenthal) writes:
>dandb at k.gp.cs.cmu.edu (Dean Rubine) writes:
>>I also occasionally use the comma to save braces:
>>	if((f = fopen(file, "r")) == NULL)
>>		fprintf(stderr, "Can't open %s\n", file), exit(2);
>
>Funny, I use braces to save commas:
>	if ((f = fopen(file, "r")) == NULL) {
>		fprintf(stderr, "Can't open %s\n", file);
>		exit(2);
>	}

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.
Am I being hopelessly pedestrian here?

Just curious,
Kevin




-- 
 Kevin Dooley         UUCP - {uunet,pyramid}!utai!helios.physics!dooley
 Physics Dept.        BITNET - dooley at utorphys
 U. of Toronto        INTERNET - dooley at helios.physics.utoronto.ca



More information about the Comp.lang.c mailing list