Home Segments Top Top Previous Next

429: Sidetrip

C and C++ do not prescribe the order in which operands are evaluated for many operators, including the + operator. In those languages, the use of side-effect operators, such as ++ and --, can lead to mysterious portability problems.

Other mysterious problems occur because a C or C++ compiler is free to compile certain expressions for left-side-first evaluation and others for right-side-first evaluation. Thus, side-effect operands can cause plenty of trouble in those languages.