[fpc-devel] C-block reference syntax (blocker for 3.2)

Michael Van Canneyt michael at freepascal.org
Thu Dec 12 08:51:03 CET 2019

On Wed, 11 Dec 2019, Ryan Joseph via fpc-devel wrote:

>> On Dec 11, 2019, at 4:16 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>> It does gain something: it tells you it is NOT a varargs, but an array of
>> const, which is a different beast altogether.
> But it's a syntax equivalent for "a variable amount of arguments", i.e. varargs. ;) I guess others don't see it this way however.

In difference with varargs, Array of const can appear anywhere in the list of
arguments: for the compiler, it really is 1 argument.

See e.g. Exception.CreateFmtHelp:


In private code I use this a lot, I even have

Somecall(fmt : String; args : Array of Const; anOptionalArg : TType = SomeDefault);

for such cases, if you were to drop the [], the compiler has no way to know what to do in general.


More information about the fpc-devel mailing list