Jump to content


Photo

MaxInt inconsistent / buggy behaviour


  • Please log in to reply
No replies to this topic

#1 field

field
  • Members
  • 10 posts

Posted 30 December 2016 - 03:32 PM

Hi,

 

SMS 2.2.2.4543:

 

MaxInt is not behaving correctly - different from Delphi MaxInt is (also) defined as a (compiler-magic) function

 

[InternalMax MaxInt](v1, v2 : Integer) : Same as the integer version of Max

 

But the compiler also accepts it as a static/constant = 2147483647 (which is also the standard delphi behaviour).

As a default-parameter for procedures/functions this works correctly 

 

function TXyz.CanDo(AtTime: TDateTime = -1; AQueryOffset: Integer = MaxInt) : Boolean;

correctly translates to 

function TXyz.CanDo(AtTime: TDateTime = -1; AQueryOffset: Integer = 2147483647) : Boolean;

 

BUT

 

if (AQueryOffset=MaxInt) then ...

 

incorrectly translates to 

 

[js] if (AQueryOffset$2==MaxInt$_()) {...

 

which causes an exception!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users