Home Segments Index Top Previous Next

62: Mainline

C++ follows standard practice with respect to the syntax rules that dictate how the C++ compiler crystallizes operands around operators. In the following, for example, the C++ compiler takes 6 + 3 * 2 to be equivalent to 6 + (3 * 2), rather than to (6 + 3) * 2, because multiplication has precedence higher than addition:

6 + 3 * 2       // Equivalent to 6 + (3 * 2), rather than (6 + 3) * 2 
                // Equivalent to 12, rather than 18