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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to