DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PrintPreview and Range Checking

 
   Reply to topic    DELPHI AREA Forum Index -> DELPHI AREA's Products
View previous topic :: View next topic  
Author Message
sebybar
Member


Joined: 18 Nov 2003
Posts: 2

PostPosted: 18/11/03 19:06    Post subject: PrintPreview and Range Checking Reply with quote

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?
Back to top
View user's profile Send e-mail
Johnny_Bit
Junior Member


Joined: 15 Jun 2003
Posts: 82

PostPosted: 19/11/03 07:44    Post subject: Reply with quote

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)
Back to top
View user's profile
sebybar
Member


Joined: 18 Nov 2003
Posts: 2

PostPosted: 19/11/03 12:30    Post subject: Reply with quote

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)
Back to top
View user's profile Send e-mail
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 206

PostPosted: 19/11/03 14:02    Post subject: Reply with quote

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.
Back to top
View user's profile Send e-mail Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 206

PostPosted: 20/11/03 17:01    Post subject: Reply with quote

There's something wrong in the following code?

Code:
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.
Back to top
View user's profile Send e-mail Visit poster's website
Display posts from previous:   
   Reply to topic    DELPHI AREA Forum Index -> DELPHI AREA's Products All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB 2.0.6 © 2001, 2002 phpBB Group