Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!asuvax!hrc!gtephx!reesd From: reesd@gtephx.UUCP (David Rees) Newsgroups: comp.lang.c Subject: Re: comma operator Summary: Comma Operator Evaluation Order Message-ID: <44c53d5b.f9df@gtephx.UUCP> Date: 1 Aug 89 15:31:00 GMT References: <10099@mpx2.mpx.com> <93@microsoft.UUCP> <10100@mpx2.mpx.com> <1989Jul28.174033.12734@jarvis.csri.toronto.edu> Organization: AG Communication Systems, Phoenix, Arizona Lines: 13 > 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); WOuldn't this cause problems based on the order of evaluation? I know that the evalaution of the variables can be either left to right, or right-to-left (depending on the machine). Does this mean that the order of execution would also depend on the machine? Also by using braces and semi-colons we know exactly what order things are going to go in. Of course, it does save braces. -Dave