Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!roemer From: roemer@cs.vu.nl (Roemer Lievaart) Newsgroups: comp.lang.c Subject: Re: comma operator Message-ID: <2982@solo9.cs.vu.nl> Date: 5 Aug 89 00:21:12 GMT References: <2963@solo6.cs.vu.nl> <2135@zaphod.axion.bt.co.uk> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 46 I wrote: >> I often write: >> >> if (something_goes(wrong) ) >> fprintf(stderr, "%s: I give up!\n", argv[0] ) , >> exit(2) ; >> >> Of course it's no better than using { ; }, but it's not worse either. skilbane@zaphod.axion.bt.co.uk (Steven Kilbane) wrote >Personally, I think it is worse that {;}. If you have something of the form > x = Expr1 , Expr2; >then Expr2 will be assigned to x, rather than Expr1. If you rewrite them as > x = Expr1, > Expr2; >you're relying on (a) the indentation and (b) being very careful, to notice you >have a comma instead of a semicolon. Inserting extra code might be nasty: > x= Expr1, > Expr3; > Expr2; >*BOOM*... What BOOM? I gave a very specific example of where I use the comma-operator, where it is not better or worse than using { ; }. You come up with very, very different examples. Situations where I maybe would never dream of using the comma operator. I never said I always use the comma operator instead of { ; }, did I? Sorry, but this is no reason for you to say "BOOM"! :-) *BOOM* yourself.... ;-) Regards, Roemer. ____________________________________________________________________________ Roemer B. Lievaart | "We would have killed him totally, were it not that an Amsterdam, Holland | unexplicable fear made our heart stink into our boots Europe, Earth. | and we slunk off, and so I stand before you... How well roemer@cs.vu.nl | put, but nobody listens..." -- Alfred Jarry's "Ubu Roi" Or, to quote somenody (dunno who anymore): I like the comma operator. I seldom use it, but I like it.