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:
  if o is TComponent and b then ; 

  // this fails, correct
  if b and o is TComponent then ; 

  // for completeness, this fails:
  if TComponent and b then ;
end.

The strange thing, is that the Delphi compiler works as fpc and the
Delphi docs says the same as the fpc docs:
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Expressions_(Delphi)#Operator_Precedence


Mattias
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to