When using multiple operands in an expression, the precedence rules of table (8.1) are used.
|
When determining the precedence, the compiler uses the following rules:
Remark: The order in which expressions of the same precedence are evaluated is not guaranteed to be left-to-right. In general, no assumptions on which expression is evaluated first should be made in such a case. The compiler will decide which expression to evaluate first based on optimization rules. Thus, in the following expression:
a := g(3) + f(2);
|
f(2) may be executed before g(3). This behaviour is distinctly different from Delphior Turbo Pascal.
If one expression must be executed before the other, it is necessary to split up the statement using temporary results:
e1 := g(3);
a := e1 + f(2); |