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

Martin Frb lazarus at mfriebe.de
Thu Dec 12 17:05:39 CET 2019

On 12/12/2019 15:34, Michael Van Canneyt wrote:
> On Thu, 12 Dec 2019, Martin Frb wrote:
>> That still would not break, but it actually is the base for something 
>> that would break.
> The point was to demonstrate that array of const is 1 argument. It is 
> not equal to a variable number of arguments.
Only if I read the other mails of this argument correctly (and it may be 
the case I misunderstood something), then that point was never disputed.
The call was to "drop the [] if the open array is the last argument in 
the list"
And this was not, because the called method expects more than one 
argument. The called message is still declared "array of ...". The 
called message still accepts it as that single param.

But the "drop []" call was made, because the compiler would be able to 
determine (even without the []) that the remaining param would be *one* 
single open-array param.

So my interpretation of this request is, that the clarity of having [], 
could be dropped for a perceived benefit of maybe less typing or maybe 

As for my personal view on this: Not in favour.
But anyway I did not want to add my personal view. I thought that 
potentially the argument was missing the point. If it was not, then 
apologies for the noise.

>> It was already mentioned, that the [] can be dropped if the array has 
>> *exactly one* element.
> Not sure what you mean here, but even if there is only 1 argument, 
> today the [] cannot be dropped:

I referred to the following previous post in this conversation. (very 
last line from Sven)
On 10/12/2019 23:14, Sven Barth via fpc-devel wrote:
> Ryan Joseph via fpc-devel <fpc-devel at lists.freepascal.org 
> <mailto:fpc-devel at lists.freepascal.org>> schrieb am Di., 10. Dez. 
> 2019, 22:29:
>     DoThis(firstParam, [1,2,3]);
>     doesn't really need the [] in this case since the last parameters
>     would have to be an array of const.
> Fun fact: There is in fact one such case for open arrays: a single 
> element may be passed without the square brackets.
I may have misread it. And yes I took it from what I read and did not 
test it. Having tested it now, it seems that you are right, and brackets 
are needed too.
I never tried it, because I never needed (nor wanted) it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20191212/3d090637/attachment.html>

More information about the fpc-devel mailing list