Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!ig!arizona!robert From: robert@arizona.edu (Robert J. Drabek) Newsgroups: comp.lang.c Subject: Re: comma operator Summary: answer Message-ID: <13074@megaron.arizona.edu> Date: 3 Aug 89 16:51:39 GMT References: <10099@mpx2.mpx.com> <93@microsoft.UUCP> <10100@mpx2.mpx.com> <918@helios.toronto.edu> Organization: U of Arizona CS Dept, Tucson Lines: 27 In article <918@helios.toronto.edu>, dooley@helios.toronto.edu (Kevin Dooley) writes: > > 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. I agree with you. The one place, though, where it is used is in "for" loops: for (i = 0, j = 9; ...; i++, j--) I have seen the following "attempt" at using a comma operator in a function call: func(expr1, expr2) The writer thought he was using the comma operator since the function had been defined as having a single argument. He did get func((expr1, expr2)) to work. I don't know if all compilers would get this, though. -- Robert J. Drabek Department of Computer Science The University of Arizona Tucson, AZ 85721