tb0433.pp 550 B

12345678910111213141516171819202122232425262728293031323334353637
  1. {$ifdef fpc}
  2. {$mode tp}
  3. {$endif fpc}
  4. function times2(x : longint) : longint;
  5. begin
  6. times2:=2*x;
  7. end;
  8. var
  9. x:function(x:longint):longint;
  10. y:pointer absolute x;
  11. z,w,v:pointer;
  12. begin
  13. z:=@@x;
  14. w:=addr(@x);
  15. v:=@(addr(x));
  16. writeln(longint(y),' ',longint(z),' ',longint(w),' ',longint(v));
  17. if (z<>w) or (z<>v) then
  18. begin
  19. writeln('Addr Error');
  20. halt(1);
  21. end;
  22. if (y<>nil) then
  23. begin
  24. writeln('Absolute Error');
  25. halt(1);
  26. end;
  27. x:=times2;
  28. if (y<>@times2) then
  29. begin
  30. writeln('Absolute Error');
  31. halt(1);
  32. end;
  33. end.