[fpc-devel]Bugs in setlength for multidimensional dynamic arrays: first partial fix
Pavel V. Ozerski
pavel at insect.mail.iephb.ru
Fri Sep 14 12:11:54 CEST 2001
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
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.
Sincerely, Pavel
More information about the fpc-devel
mailing list