[fpc-devel] Evaluation order in expressions

Ondrej Pokorny lazarus at kluug.net
Tue Jul 30 08:30:36 CEST 2019


On 30.07.2019 08:23, Ondrej Pokorny wrote:
> /Remark: The order in which expressions of the same precedence are 
> evaluated is not guaranteed to be left-to-right./
>
> Is this valid for boolean expressions, too? I use the following 
> construct with {$BOOLEVAL OFF}:
> Result := Assigned(MyObject) and (MyObject.Value>5);
>
A moment of relief. The FPC compiler itself depends on the left-to-right 
evaluation. E.g. compiler/aoptbase.pas, line 284:

     while assigned(p1) and assigned(p2) and GetNextInstruction(p1,p1) 
and (p1<>p2) do


So is the documentation wrong or are the compiler (and also my own) 
sources flawed?

Best
Ondrej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190730/e78e3c12/attachment-0001.html>


More information about the fpc-devel mailing list