Recent

Author Topic: Range Checking Directive  (Read 5494 times)

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Range Checking Directive
« on: January 29, 2009, 09:09:29 am »
Hi all,

I dont know where to place this post, i placed it in here. :)
My question is so simple that, i add the {$R+} range checking directive but fpc compiles the following code without any error.
Thanks.

procedure TForm1.FormCreate(Sender: TObject);
var
   a: longint;
begin
   edit1.Text:=inttostr(high(a)+10);
end;                               

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: Range Checking Directive
« Reply #1 on: January 29, 2009, 09:30:41 am »
And what if you add overflow checking {$Q+} ?

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: Range Checking Directive
« Reply #2 on: January 29, 2009, 01:15:34 pm »

Hi Vincent,

Also add the {$Q+} (overflow checking, but it doesnt effect.
I got the same result.
Thanks

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: Range Checking Directive
« Reply #3 on: January 29, 2009, 02:57:47 pm »
I have no idea. Maybe you can convert your program to a console app (not requiring the LCL) and ask on the fpc mailing lists?

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Range Checking Directive
« Reply #4 on: January 29, 2009, 03:21:21 pm »
IntToStr is overloaded, with a version that also takes Int64 as input.

Thanks.

-Phil

 

TinyPortal © 2005-2018