<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 07.07.2018 08:05, Ondrej Pokorny
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:6f61caea-94c3-4ea3-deb5-2bea3a447f5b@kluug.net">
<div class="moz-cite-prefix">On 03.07.2018 22:08, Florian Klämpfl
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:7b8583ba-fa60-7579-6dc3-e25e95185afc@freepascal.org">Am
03.07.2018 um 21:30 schrieb Ondrej Pokorny: <br>
<blockquote type="cite">On 03.07.2018 20:54, Florian Klämpfl
wrote: <br>
</blockquote>
<blockquote type="cite"> program Project1; <br>
type <br>
TMyArray = array[0..10] of Integer; <br>
procedure Init2(var A: TMyArray); <br>
begin <br>
A[2] := 1; <br>
end; <br>
var <br>
A: TMyArray; <br>
begin <br>
Init2(A); <br>
end. <br>
<br>
should not emit the warning because A is not being read in
Init2. <br>
</blockquote>
<br>
(please note it throws only a hint in this case as A *is*
initialized as it is a global variable).</blockquote>
<br>
<b>2.) Assumption 2: A is not initialized if is a not a global
variable. Wrong.</b></blockquote>
<br>
<br>
I forgot to say: this is valid for managed types only. But all my
arguments are valid anyway. See local variables:<br>
<br>
program Project1;<br>
procedure InitS(var S: string);<br>
begin<br>
end;<br>
procedure InitI(var I: Integer);<br>
begin<br>
end;<br>
procedure Test;<br>
var<br>
S: string;<br>
I: Integer;<br>
begin<br>
InitS(S); // << project1.lpr(13,12) Hint: Local variable
"S" of a managed type does not seem to be initialized<br>
InitI(I); // << project1.lpr(14,12) Hint: Local variable
"I" does not seem to be initialized<br>
end;<br>
begin<br>
Test;<br>
end.<br>
<br>
program Project1;<br>
procedure InitS(var S: string);<br>
begin<br>
end;<br>
procedure InitI(var I: Integer);<br>
begin<br>
end;<br>
var<br>
S: string;<br>
I: Integer;<br>
begin<br>
InitS(S); // << project1.lpr(13,10) Hint: Variable "S" of a
managed type does not seem to be initialized<br>
InitI(I); // << project1.lpr(14,10) Hint: Variable "I" does
not seem to be initialized<br>
end.<br>
<br>
As you see, all messages are hints only, no warnings. Regardless of
managed/not-managed global/local variable.<br>
<br>
Ondrej<br>
</body>
</html>