Path: utzoo!utgpu!radio.astro!helios!dooley From: dooley@helios.toronto.edu (Kevin Dooley) Newsgroups: comp.lang.c Subject: Re: comma operator Message-ID: <918@helios.toronto.edu> Date: 31 Jul 89 14:06:51 GMT References: <10099@mpx2.mpx.com> <93@microsoft.UUCP> <10100@mpx2.mpx.com> <10562@smoke.BRL.MIL> <1989Jul24.194646.3012@nc386.uucp> <5630@pt.cs.cmu.edu> <1989Jul28.174033.12734@jarvis.csri.toronto.edu> Reply-To: dooley@helios.physics.utoronto.ca (Kevin Dooley) Organization: University of Toronto Physics/Astronomy/CITA Lines: 29 In article <1989Jul28.174033.12734@jarvis.csri.toronto.edu> flaps@dgp.toronto.edu (Alan J Rosenthal) writes: >dandb@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@utorphys U. of Toronto INTERNET - dooley@helios.physics.utoronto.ca