tw36863.pp 557 B

123456789101112131415161718192021222324252627282930
  1. { %OPT=-Ct -CR }
  2. {$M 65536,65536}
  3. type
  4. TObj = object
  5. v: array [0..$2000] of Byte;
  6. procedure Proc(depth: Integer);
  7. procedure VProc; virtual;
  8. end;
  9. procedure TObj.VProc;
  10. begin
  11. end;
  12. procedure TObj.Proc(depth: Integer);
  13. begin
  14. {stack is eaten here on the function entry}
  15. if (depth < 64) then
  16. Proc(depth+1);
  17. {do not actually call the method since the obj is not initialized, just for minimal demonstration}
  18. if (depth < 0) then
  19. VProc;
  20. end;
  21. var
  22. Obj: TObj;
  23. begin
  24. Obj.Proc(0);
  25. writeln('Completed');
  26. end.