Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prohibit functions returning void as expressions #3

Open
lucivpav opened this issue Jul 4, 2016 · 2 comments
Open

Prohibit functions returning void as expressions #3

lucivpav opened this issue Jul 4, 2016 · 2 comments

Comments

@lucivpav
Copy link
Owner

lucivpav commented Jul 4, 2016

No description provided.

@lucivpav
Copy link
Owner Author

Note that using the output of a procedure as an expression currently results in an error that comes from LLVM. That's not optimal, but at least it does not compile.

@lucivpav
Copy link
Owner Author

lucivpav commented Oct 29, 2021

procedure f(a : integer);
begin
  writeln(a);
end;

begin
  f(writeln(10));
end.

This program compiles and prints:

10
3

which is weird (undefined?).

Same behaviour for this program:

var a: integer;
begin
  a := writeln(10);
  writeln(a);
end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant