Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2020-03

Size of pdynarraytypeinfo

8 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Sven Barth
to fredvs
fredvs wrote 16 lines
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

Reply by email

fredvs
to Sven Barth

Hello Sven.

Always good news with you!

OK, I did replace all call to pdynarraytypeinfo with PTypeInfo and adapt all code for this.

And you know what: IT WORKS!

I am totally surprised but now msestat files are ok with fpc 3.3.1.

Well, well, well done Sven (you could not imagine how happy I am).

Now I will do extended test to check is all is really ok.

By the way, may I use this tip for fpc < 3.3.1 or is it ok only with fpc trunk?

Many thanks Sven.

Fre;D

-----
Many thanks ;-)

Reply by email