<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Am 24.09.2013 16:40, schrieb Dennis
Poon:<br>
</div>
<blockquote cite="mid:5241A443.9060007@avidsoft.com.hk" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<br>
<br>
Sven Barth wrote:
<blockquote cite="mid:524175A4.3090907@googlemail.com" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">
<blockquote type="cite">does Advanced Record constructor
automatically zero all the memory space of that record?</blockquote>
No, it does not. Neither in Delphi nor in FPC.<br>
<br>
Am 24.09.2013 12:36, schrieb Dennis Poon:<br>
</div>
<blockquote cite="mid:52416B3E.5070006@avidsoft.com.hk"
type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<font size="+1">if not, is there a clean and easy way to
initialize
the entire record memory space to zeros e.g. <br>
<br>
constructor TMyRecord.Create(TheValue : Integer);<br>
begin<br>
FillChar(self, sizeof(Self), 0);<br>
Value := TheVal;<br>
end;<br>
</font></blockquote>
<font size="+1"><font size="+1">You can use either FillChar as
you
did or <font size="+1">use "Self <font size="+1">:=
Default(TTest);"</font></font></font></font>
(default is a compiler intrinsics that returns a 0 value of the
type
you passed in, e.g. Nil for classes, '' for strings, 0 for
ordinals and
for records all fields are set to 0)<br>
<blockquote cite="mid:52416B3E.5070006@avidsoft.com.hk"
type="cite"><font size="+1"> Is there a Self variable for
advanced record
methods/constructors ?<br>
</font></blockquote>
<font size="+1">Yes.</font><br>
<blockquote cite="mid:52416B3E.5070006@avidsoft.com.hk"
type="cite"><font size="+1"> By the way, is there an ultimate
inherited constructor
"Create" for all advanced record types?</font><br>
</blockquote>
No.<br>
<br>
Regards,<br>
Sven<br>
<br>
</blockquote>
<br>
Thanks for your help.<br>
<br>
Are the above info. available anywhere in FPC's web site that I
overlooked? If not, maybe it should be added to its wiki.<br>
</blockquote>
Both points should be added to the documentation, but since they
both are implemented only in trunk this is not the case yet.<br>
<br>
Default() is also mentioned here:
<a class="moz-txt-link-freetext" href="http://wiki.lazarus.freepascal.org/FPC_New_Features_Trunk#New_compiler_intrinsic_Default">http://wiki.lazarus.freepascal.org/FPC_New_Features_Trunk#New_compiler_intrinsic_Default</a><br>
<br>
Regards,<br>
Sven<br>
</body>
</html>