Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!mcvax!ukc!axion!skilbane From: skilbane@zaphod.axion.bt.co.uk (Steven Kilbane) Newsgroups: comp.lang.c Subject: Re: comma operator Message-ID: <2135@zaphod.axion.bt.co.uk> Date: 3 Aug 89 07:32:05 GMT References: <2963@solo6.cs.vu.nl> Sender: news@axion.bt.co.uk Reply-To: skilbane@zaphod.axion.bt.co.uk Lines: 37 From article <2963@solo6.cs.vu.nl>, by roemer@cs.vu.nl (Roemer Lievaart): > tada@athena.mit.edu (Michael Zehr) writes: > 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. 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*... -oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo-oOo Stephen Kilbane |Email: skilbane@uk.co.bt.axion British Telecom Research Laboratories|or smk-a@uk.ac.york.minster (or, if that Martlesham Heath |doesn't work, root@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]