[fpc-pascal] Default value for an open array

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Fri Jun 1 16:45:48 CEST 2012


It's previously been pointed out to me that a declaration such as

     procedure OutputWriteF(const str: widestring; values: array of 
const; fg: TColor= clBlack; bg: TColor= clDefault);

can't be rewritten

type owfArray: array of const;
     procedure OutputWriteF(const str: widestring; values: owfArray; fg: 
TColor= clBlack; bg: TColor= clDefault);

since this would make the parameter into a dynamic rather than an open 
array. I'm entirely happy to accept that now that I understand it.

However, given a declaration of that form, is it possible to define a 
default parameter of [] so that  OutputWriteF('Test, no params\n')  is 
valid?

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list