[fpc-devel]Bugs in setlength for multidimensional dynamic arrays: first partial fix
Michael.VanCanneyt at Wisa.be
Michael.VanCanneyt at Wisa.be
Fri Sep 14 23:32:44 CEST 2001
On Fri, 14 Sep 2001, Pavel V. Ozerski wrote:
> Hello, I try to understand the way of working of setlength.
>
> 1)
> A question: why tdynarraytypeinfo structure is so strange?
>
> tdynarraytypeinfo = packed record
> kind : byte;
> namelen : byte;
> { here the chars follow, we've to skip them }
> elesize : t_size;
> eletype : pdynarraytypeinfo;
> end;
>
> If it is made so not for, e.g. Delphi compatibility, may be, that would be better, to reorder fileds in it to move
> variable-length part to end of structure. This change could avoid strange and dangerous pointer operations to get
> .elesize and .eletype values
The type is declared like that exactly for Delphi compatibility; The RTTI
information is stored like that.
> Example:
>
> tdynarraytypeinfo = packed record
> kind : byte;
> elesize : t_size;
> eletype : pdynarraytypeinfo;
> case integer of
> 0:(namelen:byte);
> 1:(name:string[255]);
> end;
>
> 2) but what is a mean, to include type names into executable? I think, for most cases the information about element size is enough.
This is needed for Run-Time Type Information - for streaming.
Michael.
More information about the fpc-devel
mailing list