Prof A Olowofoyeku (The African Chief) wrote:
On 18 Apr 2004 at 17:55, Waldek Hebisch wrote:
However, I do not know if the following is accepted by Delphi:
program delf101; procedure pi (i : integer); forward; procedure pi (); begin end; begin end .
It is not accepted. Delphi thinks you are trying to overload 'pi' without doing it properly. This is the error: "E:\temp\delf101.pas(3) Error: Previous declaration of 'pi' was not marked with the 'overload' directive E:\temp\delf101.pas(8) E:\temp\delf101.pas(2) Error: Unsatisfied forward or external declaration: 'pi'"
Now, this is accepted: program delf102; procedure pi (i : integer); overload; begin end; procedure pi (); overload; begin end; begin end.
Well, before we will do overloading we have to finish qualified indentifiers.
In the program above I really wanted `forward' declaration -- the point is how much meaning do the empty parentheses have. And I hope that declarations in interfaces and methods behave the same, so I started with `forward'. It seems that empty parentheses in procedure definition mean no parameteres (while ommited parameters in standard Pascal mean that the compiler should use parameters from forward declaration).
If my interpretation is correct the examples below should be accepted:
{ standard Pascal} procedure pi (i : integer); forward; procedure pi; begin end;
----
procedure pe ; forward; procedure pe (); begin end;
----
procedure pe (); forward; procedure pe ; begin end;
----
procedure pe (); forward; procedure pe (); begin end;