[fpc-pascal] precedence "is" and "and"

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Dec 8 20:50:59 CET 2018


On Sat, 8 Dec 2018 20:38:23 +0100
Mattias Gaertner via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:

>[...]
> According to the docs, the "is" operator is fourth level, the "and" is
> second level, so the "and" must be computed before the "is". But it
> seems fpc treats "is" and "and" as same level:
>[...]

Btw, there is a difference between fpc and delphi treating "is" and
"or" precedence. The following compiles in fpc, but not in Delphi:

if b or o is TComponent then ;

Same with "xor".

This compiles in fpc and Delphi:
if o is TComponent or b then ;

It seems under Delphi "is", "and", "or", "xor" have the same precedence
level and the Delphi docs are wrong.

Mattias



More information about the fpc-pascal mailing list