PrintPreview and Range Checking

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

PrintPreview and Range Checking

Postby sebybar » November 18th, 2003, 7:06 pm

I found that the PrintPreview Component raise a runtime error if you compile it with the range checking option.
Try to compile the General Demo project and move the scroll bar.
Is it dangerous for my application?
sebybar
Member
Member
 
Posts: 2
Joined: November 18th, 2003, 7:00 pm

Postby Johnny_Bit » November 19th, 2003, 7:44 am

Range Checking is only for debuging matters, it slows down whole application. If you're writing good code, range checking could be allways off.

This is dangerous if your application is more than tinny and yo're trying to run it on slow computer (e.g. lest than 333MHz)
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby sebybar » November 19th, 2003, 12:30 pm

Yes, I know that.
But I meant another thing:
If a range checking error is raised, it means that something is going wrong with the procedure. Is it a bug? Is it a serious bug?


Johnny_Bit wrote:Range Checking is only for debuging matters, it slows down whole application. If you're writing good code, range checking could be allways off.

This is dangerous if your application is more than tinny and yo're trying to run it on slow computer (e.g. lest than 333MHz)
sebybar
Member
Member
 
Posts: 2
Joined: November 18th, 2003, 7:00 pm

Postby Kambiz » November 19th, 2003, 2:02 pm

It's not always because of an out of range index reference. Sometimes the range check code (added by compiler) makes a mistake, specially on parameters of API calls.
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Kambiz » November 20th, 2003, 5:01 pm

There's something wrong in the following code?

Code: Select all
type
  PByteArray = ^TByteArray;
  TByteArray = array[0..0] of Byte;
var
  pba: PByteArray;
  I: Integer;
begin
  GetMem(pba, 100);
  try
    for I := 0 to 99 do
      pba[I] := I;
    // The rest of code
  finally
    FreeMem(pba);
  end;
end.

Absolutely not! However, when range checking is on, a run-time error will terminate the program.
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 2 guests

cron