Jump to content
Sign in to follow this  
field

MaxInt inconsistent / buggy behaviour

Recommended Posts

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!


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×