| View previous topic :: View next topic |
| Author |
Message |
sebybar Member
Joined: 18 Nov 2003 Posts: 2
|
Posted: 18/11/03 19:06 Post subject: PrintPreview and Range Checking |
|
|
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 |
|
 |
Johnny_Bit Junior Member
Joined: 15 Jun 2003 Posts: 82
|
Posted: 19/11/03 07:44 Post subject: |
|
|
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 |
|
 |
sebybar Member
Joined: 18 Nov 2003 Posts: 2
|
Posted: 19/11/03 12:30 Post subject: |
|
|
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 |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 206
|
Posted: 19/11/03 14:02 Post subject: |
|
|
| 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 |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 206
|
Posted: 20/11/03 17:01 Post subject: |
|
|
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 |
|
 |
|