comma operator

Steven Kilbane skilbane at zaphod.axion.bt.co.uk
Wed Aug 2 17:33:40 AEST 1989


>From article <918 at helios.toronto.edu>, by dooley at helios.toronto.edu (Kevin Dooley):
> 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?

Well, in addition to the points about macro use, my own _personal_ feeling is
that it can highlight associations:

1	x=5;
	for (c='k';...;..) {

2	for (x=5,c='k';...;..) {

Now, to me, the first form indicates that c will be used in the loop, and that
x might be. The second strongly hints that both c and x will be used in the
loop.

I dunno - maybe I'm just sick.
-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo
Stephen Kilbane                      |Email: skilbane at uk.co.bt.axion
British Telecom Research Laboratories|or smk-a at uk.ac.york.minster (or, if that
Martlesham Heath                     |doesn't work, root at uk.ac.york.softeng - 
Ipswich IP5 7RE (0473 646638)        |not me, but it may be passed on....
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Disclaimer: Who? Me? Nah - must have been someone else when my back was turned!
Quotes: "If silence is golden, music is platinum"
        "'You haven't lived till you've died in MUD' - I live a lot!"
        "(If platinum is to gold, what is to golden?)"[This space to rent]



More information about the Comp.lang.c mailing list