tw20075.pp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. { %cpu=i386 }
  2. program tw20075;
  3. {$mode delphi}
  4. uses
  5. Classes;
  6. type
  7. TNodeArray = array of Pointer;
  8. { TTest }
  9. TTest = class
  10. function GetCount(TheArray: TNodeArray; Count: Integer): Integer;
  11. function GetCountNoExceptions(TheArray: TNodeArray; Count: Integer): Integer;
  12. end;
  13. function TTest.GetCount(TheArray: TNodeArray; Count: Integer): Integer; assembler;
  14. asm
  15. MOV EAX, ECX
  16. end;
  17. {$IMPLICITEXCEPTIONS OFF}
  18. function TTest.GetCountNoExceptions(TheArray: TNodeArray; Count: Integer): Integer; assembler;
  19. asm
  20. MOV EAX, ECX
  21. end;
  22. {$IMPLICITEXCEPTIONS ON}
  23. var
  24. T: TTest;
  25. N: TNodeArray;
  26. I, R: Integer;
  27. begin
  28. T := TTest.Create;
  29. I := 10;
  30. SetLength(N, I);
  31. R := T.GetCount(N, I);
  32. if R <> I then
  33. begin
  34. WriteLn('Normal: R <> I / R = ', R);
  35. halt(1);
  36. end
  37. else
  38. WriteLn('Normal: R = I = ', R);
  39. R := T.GetCountNoExceptions(N, I);
  40. if R <> I then
  41. begin
  42. WriteLn('WithoutException: R <> I / R = ', R);
  43. halt(1);
  44. end
  45. else
  46. WriteLn('WithoutException: R = I = ', R);
  47. T.Destroy;
  48. writeln('ok');
  49. end.