[fpc-devel] open array calling [[was: Re: C-block reference syntax (blocker for 3.2)]]

Michael Van Canneyt michael at freepascal.org
Thu Dec 12 23:48:13 CET 2019



On Thu, 12 Dec 2019, Sven Barth via fpc-devel wrote:

>> Hm. I modified the delphi program to check. It also works with a 
>> variable...
>>
>> What kind of braindead "feature" is this ? :(
> I don't know why Borland decided to add this back then, but the 
> implementation itself is rather easy as an open array is simply a 
> pointer to the first element and a count. Thus for variables the 
> compiler simply takes the pointer to the variable and passes a constant 
> 1 as count.

Well I thought about it.

Maybe it stems from string = array of char and open strings. 
and 'a' is a char or a string = array of char.

Who knows. I am of the opinion it is confusing, but since it is needed for
Delphi compatibility there is little we can do.


Michael.


More information about the fpc-devel mailing list