tbs0243.pp 686 B

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