hatte es mal aus Interesse einfach getestet und...
Delphi-Quellcode:
Program Project1;
{$APPTYPE CONSOLE}
Uses SysUtils;
// wegen Compileroptimierung und Nutzungswarnung:
// If i = 0 Then ;
{$OVERFLOWCHECKS ON}
Procedure P1;
Var i: Integer;
Begin
i := MaxInt; If i = 0 Then ;
Try
Inc(i); If i = 0 Then ;
WriteLn('P1 - OverflowChecks OFF (global ON)');
Except
WriteLn('P1 - OverflowChecks ON (global ON)');
End;
End;
{$OVERFLOWCHECKS OFF}
Procedure P2;
Var i: Integer;
Begin
i := MaxInt; If i = 0 Then ;
Try
Inc(i); If i = 0 Then ;
WriteLn('P2 - OverflowChecks OFF (global OFF)');
Except
WriteLn('P2 - OverflowChecks ON (global OFF)');
End;
End;
Procedure P3;
{$OVERFLOWCHECKS ON}
Var i: Integer;
Begin
i := MaxInt; If i = 0 Then ;
Try
Inc(i); If i = 0 Then ;
WriteLn('P3 - OverflowChecks OFF (global OFF, local ON)');
Except
WriteLn('P3 - OverflowChecks ON (global OFF, local ON)');
End;
End;
Procedure P4;
Var i: Integer;
Begin
i := MaxInt; If i = 0 Then ;
Try
Inc(i); If i = 0 Then ;
WriteLn('P4 - OverflowChecks OFF (global OFF)');
Except
WriteLn('P4 - OverflowChecks ON (global OFF)');
End;
End;
{$OVERFLOWCHECKS OFF}
Procedure P5;
Var i: Integer;
Begin
i := MaxInt; If i = 0 Then ;
Try
{$OVERFLOWCHECKS ON}
Inc(i); If i = 0 Then ;
{$OVERFLOWCHECKS OFF}
WriteLn('P5 - OverflowChecks OFF (global OFF, local ON)');
Except
WriteLn('P5 - OverflowChecks ON (global OFF, local ON)');
End;
End;
Procedure P6;
Var i: Integer;
Begin
i := MaxInt; If i = 0 Then ;
Try
Inc(i); If i = 0 Then ;
WriteLn('P6 - OverflowChecks OFF (global OFF)');
Except
WriteLn('P6 - OverflowChecks ON (global OFF)');
End;
End;
Begin
P1;
P2;
P3;
P4;
P5;
P6;
ReadLn;
End.
tja, mit Lokal ala
Delphi-Quellcode:
procedure OhneRangeCheck(params);
{$R-}
begin
ist wohl nix
Code:
P1 - OverflowChecks ON (global ON)
P2 - OverflowChecks OFF (global OFF)
P3 - OverflowChecks ON (global OFF, local ON)
[color=#ff0000]P4 - OverflowChecks ON (global OFF)[/color] [color=gray]<< 1[/color]
P5 - OverflowChecks OFF (global OFF, local ON) [color=gray]<< 2[/color]
P6 - OverflowChecks OFF (global OFF)
1: hier hat wohl noch die P3 'ne Nachwirkung
2: hmmm ... irgendwie sollte hier doch auch ON stehn