8cc icon indicating copy to clipboard operation
8cc copied to clipboard

Compound assignment lvalue evaluated twice.

Open andrewchambers opened this issue 10 years ago • 0 comments

From standard: 6.5.16.2 Compound assignment

A compound assignment of the form E1 op= E2 is equivalent to the simple assignment expression E1  =  E1 op (E2) , except that the lvalue E1 is evaluated only once

Looking at the code, we are evaluating the lvalue twice, so things like side affecting functions on the lhs will be called twice.

andrewchambers avatar Jun 12 '15 00:06 andrewchambers