Newsgroups: comp.lang.c Path: utzoo!censor!comspec!tvcent!lethe!druid!darcy From: darcy@druid.uucp (D'Arcy J.M. Cain) Subject: Re: Compound Assignments (was Re: Another error!) Message-ID: <1991Apr7.185259.12709@druid.uucp> Organization: D'Arcy Cain Consulting, West Hill, Ontario References: <1991Apr4.205257.15205@mccc.edu> <1991Apr6.195901.25255@dvorak.amd.com> Date: Sun, 7 Apr 91 18:52:59 GMT In article <1991Apr6.195901.25255@dvorak.amd.com> Tim Olson writes: >| x *= y; >| x = x * y; >In the second example, "x" is not evaluated twice -- it is evaluated >only once, just as in the first example. The standard says just this >in 3.3.16.2 (Compound assignment): > A compound assignment of the form E1 op= E2 differs from the > simple assignment expression E1 = E1 op (E2) only in that the > lvalue E1 is evaluated only once. Huh? Am I missing something or does that say that the two expressions *ARE* evaluated differently? What it says is that the number of times x is evaluated is the *only* difference but it is a difference. -- D'Arcy J.M. Cain (darcy@druid) | D'Arcy Cain Consulting | There's no government Toronto, Ontario, Canada | like no government! +1 416 424 2871 |