[fpc-pascal] Passing a string to open array of string

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Mar 31 21:14:46 CEST 2012

On 31 Mar 2012, at 20:43, Martin wrote:

> On 31/03/2012 19:34, Jonas Maebe wrote:
>> 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.
> procedure Proc(const s: array of string); overload;
> procedure Proc(const s: string); overload;

The compiler only gives an error if it cannot decide which of the two or more found overloads is is the best match. In this case, the best match is clear (the non-open-array version matches exactly, the open-array matches only after a quite convoluted type conversion). There are many cases where multiple potential matches exist and the compiler will not complain.


More information about the fpc-pascal mailing list