Prof A Olowofoyeku (The African Chief) wrote:
Hi
I am not sure if we have discussed this before - but here goes anyway. Delphi (at least, from from version 2.0 onwards) allows routines that take no parameters to be called with empty brackets appended (e.g., "foo();"), much like C requires. See the test program below. GPC does not allow this. Is there any chance of supporting this in GPC?
This program is valid in Delphi, but not in GPC ...
program adelph; function bar : integer; begin bar := 1; end; procedure foo; begin Writeln (bar ()); end; begin foo (); end.
There was a long discussion around November 2002:
http://www.gnu-pascal.de/crystal/gpc/en/thread7244.html
To compile your program one has to add a single line to gpc. However, then also the following "works":
program adelph2; var bar : integer; procedure foo; begin Writeln (bar ()); end; begin bar := 1; foo (); bar() := 2; foo (); end.
I hope that Delphi does not allow my program. Also with my patch Writeln (); is still rejected (builtin functions/procedures are handled differently then user defined ones). So I would estimate that proper support will take 30-150 lines of code.