[fpc-pascal] Size of pdynarraytypeinfo

Sven Barth pascaldragon at googlemail.com
Mon Mar 23 21:18:32 CET 2020


Am 23.03.2020 um 17:49 schrieb fredvs via fpc-pascal:
> Some more infos:
>
> This gives the correct size with fpc <= 3.2.0:
>
> function dynarrayelesize(const typinfo: pdynarraytypeinfo): sizeint;
> var
>   ti: pdynarraytypeinfo;
> begin
>   ti:= typinfo;
>   inc(pointer(ti),ord(pdynarraytypeinfo(ti)^.namelen)+2);
>   result:= psizeint(ti)^;
> end;
>
> But with last trunk fpc 3.3.1 the result is always = 0.
>
> Why?

Same as the other alignment stuff. Best use PTypeInfo and PTypeData:

function DynArrayEleSize(const TypInfo: PTypeInfo): SizeInt;
begin
   Result := GetTypeData(TypInfo)^.elSize;
end;

Regards,
Sven


More information about the fpc-pascal mailing list