[fpc-pascal] Iterating over elements from GetDynArrayProp
Michael Van Canneyt
michael at freepascal.org
Sat Oct 15 10:25:01 CEST 2022
On Sat, 15 Oct 2022, Hairy Pixels wrote:
>
>
>> On Oct 15, 2022, at 3:03 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>>
>> as far as I kbow, this should be
>> ObjectArray := TObjectArray(GetDynArrayProp(AObject, PropertyInfo));
>> i.e. you get the actual array as a result.
>>
>
> You’re right, I didn’t need that pointer cast. I’m still curious though why that didn’t work. Shouldn’t the pointer still just point to the dynamic array address and basically do nothing?
No, it's perfectly logical what is happening.
You can't cast a type (TA) to a pointer to that type (^PTA) and expect the compiler to automagically forget the
extra dereference when you dereference it...
Michael.
More information about the fpc-pascal
mailing list