On 31/03/2012 19:34, Jonas Maebe wrote:
On 31 Mar 2012, at 12:07, cobines wrote:
The following program compiles and correctly prints 'something'. Is it
something supported or a bug?
It is supported. Even Turbo Pascal already supported passing a single element
as an open array parameter.
Interesting, yet the following overloaded functions, compile too. In
other cases, if more than one match for a call exists, it gives an error.
special optimization?
program Project1;
{$mode objfpc}{$H+}
procedure Proc(const s: array of string); overload;
begin
WriteLn(s[0]);
end;
procedure Proc(const s: string); overload;
begin
WriteLn(s);
end;
var
s: string = 'something';
begin
Proc(s);
readln
end.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal