[fpc-devel] Aligned dynamic arrays
Ryan Joseph
ryan at thealchemistguild.com
Sat Mar 30 13:54:26 CET 2019
> On Mar 30, 2019, at 12:56 AM, Anthony Walter <sysrpl at gmail.com> wrote:
>
> So the default property indexer returns references and not values. If you want values specifically you can use the Item property indexer.
>
> This way we can either access fields directly on the items withing the array like so:
>
> A[0].X := SomeValue;
>
Yes, but it’s a pointer so we need to dereference with ^.
A[0]^.X := 1;
That’s the one difference which we can’t resolve now. Basically we would need a “var” result introduced into the language. C++ has that feature so maybe it’s not crazy to implement in Pascal.
int& getter() {
return i;
}
function getInt: integer; var;
begin
result := i;
end;
Regards,
Ryan Joseph
More information about the fpc-devel
mailing list