Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!usc!apple!ames!uhccux!munnari.oz.au!kaukau.comp.vuw.ac.nz!lloyd From: L.Parkes@comp.vuw.ac.nz (Lloyd Parkes) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: post increment (was Best C Compiler) Message-ID: Date: 21 Mar 90 23:28:57 GMT References: <1722@geocub.greco-prog.fr> <1264@doitcr.doit.sub.org> <1990Mar19.175316.16898@Octopus.COM> <9873@wpi.wpi.edu> <9954@wpi.wpi.edu> Sender: news@kaukau.comp.vuw.ac.nz (News Admin) Organization: Victoria University of Wellington, Wellington, New Zealand Lines: 21 In-Reply-To: jhallen@wpi.wpi.edu's message of 21 Mar 90 06:21:09 GMT Your code was: > main() > { > int a=0; > int *b= &a; > printf("%d\n", (*b) + (a++) ); > } I was always under the impression that while C defined operator precedence, and operator associativity, it didn't define order of evaluation for arithmetic. Hence GCC is simply evaluating the left hand side first, which is completely legal. I don't write code like that because I never know how it will turn out. Lloyd Disclaimer: Well, I could be wrong. -- ------------------------------------------------------------------------ Lloyd | lloyd@comp.vuw.ac.nz | "... I can gleek upon occasion." - Parkes | ...!uunet!vuwcomp!lloyd | Nick Bottom ------------------------------------------------------------------------