Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!agate!pasteur!ames!hao!noao!mcdsun!sunburn!gtx!al From: al@gtx.com (0732) Newsgroups: comp.lang.c Subject: Re: Associativity -- what is it? Message-ID: <580@gtx.com> Date: 26 Feb 88 15:44:19 GMT References: <226@mccc.UUCP> <224@sdrc.UUCP> <234@mccc.UUCP> <3466@killer.UUCP> <4140@ptsfa.UUCP> Reply-To: al@gtx.UUCP (Al Filipski 839-0732) Organization: GTX Corporation, Phoenix Lines: 22 In article <4140@ptsfa.UUCP> dmt@ptsfa.UUCP (Dave Turner) writes: >I've always found it to be useful to look at ++x and x++ and say: > > x++ use the present value of x in any other expressions in this > statement before incrementing x. I hate to keep beating this horse, but the above statement is false. just see K&R p. 50. The problem the original questioner had [ essentially, "in a+b++ why does the addition appear to be done before the incrementation when the incrementation has higher priority?"] is just due to a confusion of syntax with semantics. syntactically, the ++ has higher priority and IS "applied" first. However, the semantics of applying ++ are defined in such a way as to defer the side effect. (exactly how long to defer the side effect is not well defined.) ---------------------------------------------------------------------- | Alan Filipski, GTX Corp, 2501 W. Dunlap, Phoenix, Arizona 85021, USA | | {ihnp4,cbosgd,decvax,hplabs,amdahl}!sun!sunburn!gtx!al (602)870-1696 | ----------------------------------------------------------------------