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

2018-12-08 Thread Michael Van Canneyt
On Sat, 8 Dec 2018, Mattias Gaertner via fpc-pascal wrote: On Sat, 8 Dec 2018 22:03:11 +0100 (CET) Michael Van Canneyt wrote: [...] In delphi, AS is second level, and 'is' is fourth level. http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Expressions_(Delphi) If FPC does this differently,

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

2018-12-08 Thread Martin Wynne
var b: boolean; o: TObject; begin // this compiles, but should fail: if o is TComponent and b then ; It will compile if $BOOLEVAL is on the default (-) because the result can be determined without considering precedence, see: https://www.freepascal.org/docs-html/prog/progsu4.ht

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

2018-12-08 Thread Mattias Gaertner via fpc-pascal
On Sat, 8 Dec 2018 22:03:11 +0100 (CET) Michael Van Canneyt wrote: >[...] > In delphi, AS is second level, and 'is' is fourth level. > > http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Expressions_(Delphi) > > If FPC does this differently, then I think this is an incompatibility. What has "a

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

2018-12-08 Thread Michael Van Canneyt
On Sat, 8 Dec 2018, Mattias Gaertner via fpc-pascal wrote: On Sat, 8 Dec 2018 21:23:57 +0100 Marco van de Voort wrote: Op 2018-12-08 om 20:38 schreef Mattias Gaertner via fpc-pascal: > According to the docs, the "is" operator is fourth level, the "and" > is second level, so the "and" must b

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

2018-12-08 Thread Mattias Gaertner via fpc-pascal
On Sat, 8 Dec 2018 21:23:57 +0100 Marco van de Voort wrote: > Op 2018-12-08 om 20:38 schreef Mattias Gaertner via fpc-pascal: > > 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

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

2018-12-08 Thread Marco van de Voort
Op 2018-12-08 om 20:38 schreef Mattias Gaertner via fpc-pascal: 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: logical (boolean) vs bitwise AND difference?

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

2018-12-08 Thread Mattias Gaertner via fpc-pascal
On Sat, 8 Dec 2018 20:38:23 +0100 Mattias Gaertner via fpc-pascal wrote: > Hi, > > According to the docs, the "is" operator is fourth level, the "and" is > second level, so the "and" must be computed before the "is". Link: https://www.freepascal.org/docs-html/ref/refch12.html Mattias

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

2018-12-08 Thread Mattias Gaertner via fpc-pascal
On Sat, 8 Dec 2018 20:38:23 +0100 Mattias Gaertner via fpc-pascal 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 d

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

2018-12-08 Thread Mattias Gaertner via fpc-pascal
Hi, 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: {$mode objfpc} uses Classes; var b: boolean; o: TObject; begin // this compiles, but should fail: i