<div dir="ltr">2016-02-17 15:16 GMT-02:00 Jonas Maebe <span dir="ltr"><<a href="mailto:jonas.maebe@elis.ugent.be" target="_blank">jonas.maebe@elis.ugent.be</a>></span>:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">Jonas Maebe wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
3 - When i declare a pointer as a global variable or as a member of a<br>
record, can i assume that its initial value is nil?<br>
</blockquote>
<br>
No.<br>
</blockquote>
<br></span>
Correction: all global variables are always zeroed, so that includes pointers, records and hence also pointers in records (if those records themselves are global variables). Pointers, records or record fields in are not zeroed because they are pointers/records/record fields though (so not in case they are local variables).</blockquote><div><br></div><div>Just to clarify: if i have a record type with a pointer field, this field will always zeroed?<br><br></div><div>e.g<br><br></div><div><span style="font-family:comic sans ms,sans-serif">type<br></span></div><div><span style="font-family:comic sans ms,sans-serif"> TMyRecord = record<br></span></div><div><span style="font-family:comic sans ms,sans-serif"> private<br></span></div><div><span style="font-family:comic sans ms,sans-serif"> FMyPointer: Pointer;<br></span></div><div><span style="font-family:comic sans ms,sans-serif"> public<br></span></div><div><span style="font-family:comic sans ms,sans-serif"> property MyPointer: Pointer read FMyPointer;</span> </div><div><span style="font-family:comic sans ms,sans-serif"> end; <br><br></span></div><div><span style="font-family:comic sans ms,sans-serif">......<br><br></span></div><div><span style="font-family:comic sans ms,sans-serif">procedure ShowMyPointerValue;<br></span></div><div><span style="font-family:comic sans ms,sans-serif">var<br></span></div><div><span style="font-family:comic sans ms,sans-serif"> MyRecord: TMyRecord;<br></span></div><div><span style="font-family:comic sans ms,sans-serif">begin<br></span></div><div><span style="font-family:comic sans ms,sans-serif"> writeln('My pointer value: ' + IntToStr(Integer(MyRecord.MyPointer)));<br>end;<br><br></span></div><div><span style="font-family:comic sans ms,sans-serif">end.</span><br><span id="result_box" class="" lang="en"><span class=""><br><br>is</span> <span class="">correct to say</span> <span class="">that the above code</span> <span class="">will</span> <span class="">always print</span> '</span><span id="result_box" class="" lang="en">My pointer value: 0'<span class="">?<br><br></span></span></div><div><span id="result_box" class="" lang="en"><span class="">Regards<br></span></span></div><div><br></div></div></div></div>