tb0207.pp 786 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. { %KNOWN }
  2. { Old file: tbs0243.pp }
  3. { Arguments of functions are computed from right to left this }
  4. program simpletest;
  5. var i : longint;
  6. function _next : longint;
  7. begin
  8. inc(i);
  9. _next:=i;
  10. end;
  11. procedure test(a,b : longint);
  12. begin
  13. Writeln('first arg is ',a);
  14. Writeln('second arg is ',b);
  15. end;
  16. procedure check(a,b : longint);
  17. begin
  18. if a>b then
  19. begin
  20. Writeln('FPC does not follow PASCAL rules for parameter passing');
  21. Halt(1);
  22. end;
  23. end;
  24. begin
  25. { this could give
  26. first arg is 1
  27. second arg is 2
  28. but FPC parses the second arg before the first one ! }
  29. test(_next,_next);
  30. writeln('third arg is ',_next);
  31. writeln('fourth arg is ',_next,' fifth arg is ',_next);
  32. check(_next,_next);
  33. end.