Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!apple!rutgers!att!cbnewsl!mpl From: mpl@cbnewsl.ATT.COM (michael.p.lindner) Newsgroups: comp.lang.c Subject: Re: comma operator Summary: learn C, then post Message-ID: <1351@cbnewsl.ATT.COM> Date: 2 Aug 89 16:26:52 GMT References: <10099@mpx2.mpx.com> <93@microsoft.UUCP> <10100@mpx2.mpx.com> <44c53d5b.f9df@gtephx.UUCP> Organization: AT&T Bell Laboratories Lines: 19 In article <... (names hidden to protect the guilty) > > 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); > > various erroneous discussions of how order of evaluation is wrong > or that these are statements and can't be used as expressions. ***FLAME ON!*** Sigh. RTFM! The comma operator guarantees left to right evaluation, and fprintf(...) and exit(...) ARE valid expressions in C. sputter sputter - flame off. Mike Lindner attunix!mpl or mpl@attunix.att.com AT&T Bell Laboratories 190 River Rd. Summit, NJ 07901