<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>can somebody comment on the Remark from
<a class="moz-txt-link-freetext" href="https://www.freepascal.org/docs-html/ref/refch12.html">https://www.freepascal.org/docs-html/ref/refch12.html</a> ?<br>
<i>Remark: The order in which expressions of the same precedence
are evaluated is not guaranteed to be left-to-right.</i><br>
<br>
Is this valid for boolean expressions, too? I use the following
construct with {$BOOLEVAL OFF}:<br>
Result := Assigned(MyObject) and (MyObject.Value>5);<br>
The remark above suggests that I cannot use it because
(MyObject.Value>5) may be evaluated before Assigned(MyObject)
if the optimizer decides so.<br>
<br>
On the other hand, the information in
<a class="moz-txt-link-freetext" href="https://www.freepascal.org/docs-html/current/prog/progsu4.html#x11-100001.2.4">https://www.freepascal.org/docs-html/current/prog/progsu4.html#x11-100001.2.4</a>
suggests the opposite:<br>
<i>So, in the following example, the function Bofu, which has a
boolean result, will never get called.</i><i><br>
</i><i>If False and Bofu then</i></p>
<p>Delphi documentation also explicitly states that the expressions
are evaluated in left to right order:
<a class="moz-txt-link-freetext" href="http://docwiki.embarcadero.com/RADStudio/Rio/en/Boolean_short-circuit_evaluation_(Delphi_compiler_directive)">http://docwiki.embarcadero.com/RADStudio/Rio/en/Boolean_short-circuit_evaluation_(Delphi_compiler_directive)</a></p>
<p>(Well it is no surprise because
<a class="moz-txt-link-freetext" href="https://www.freepascal.org/docs-html/ref/refch12.html">https://www.freepascal.org/docs-html/ref/refch12.html</a> states that
"<i>This behaviour is distinctly different from Delphi or Turbo
Pascal.</i>")<br>
<br>
Ondrej<br>
</p>
</body>
</html>