开发者

Record file error

I am using Delphi 2007 and I am trying to make record type file. In D开发者_C百科elphi 7 there were no problems for me.

Type
Kompiuteris = record
...
end;
Failas = file of Kompiuteris;

But in Delphi 2007 I get problem. Error says that: Type "Kompiuteris" needs finalization. So, what is wrong?


From the documentation:

Certain types are treated specially by the compiler on an internal basis in that they must be correctly finalized to release any resources that they might currently own. Because the compiler cannot determine what type is actually stored in a record's variant section at runtime, it is not possible to guarantee that these special data types are correctly finalized.

String is one of those data types which need finalization, and as such they cannot be stored in a File type.


You need to set record string fields sizing

as example :

if you have field in record called name

Type
Kompiuteris = record
   name :String[255] ; // Works fine
end;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜