Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bionet!ames!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: use of if (!cptr) and if (cptr) && a programming error Message-ID: <10584@smoke.BRL.MIL> Date: 22 Jul 89 07:51:48 GMT References: <10099@mpx2.mpx.com> <93@microsoft.UUCP> <10100@mpx2.mpx.com> <10103@mpx2.mpx.com> <8468@batcomputer.tn.cornell.edu> <14582@dartvax.Dartmouth.EDU> <2990@nmtsun.nmt.edu> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 13 In article <2990@nmtsun.nmt.edu> dwho@nmtsun.nmt.edu (David Olix) writes: -> while ( ( myptr = my_func() )->x != myptr->y ) ->THAT WILL NOT WORK! [...] -Actually, "Mastering C" by Craig Bolon, SYBEX Inc., p. 273 says that -parenthesis operators have the HIGHEST priority, therefore what's inside -(myptr = my_func()) would get evaluated first. Also, it specifies that -grouping for the '!=' operator is from left to right. That's confusing precedence and associativity, which determine how to parse the expression, with order of execution. Execution order is mainly constrained by what are called "sequence points" in the pANS. There are some sequence points within the expression, but not enough to disambiguate the use of `myptr'.