<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Jonas Maebe wrote:
<blockquote
cite="mid:2DAE5FF3-EBD2-4538-A273-B7FEB6A7103B@elis.ugent.be"
type="cite">
<pre wrap="">On 17 Nov 2009, at 12:04, Graeme Geldenhuys wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I asked a question about a compiler hint in the fpc-users mailing list.
As JoshyFun suggested, is it not maybe better to change FillChar()
definition so first parameter is a out parameter - to prevent
unnecessary compiler hint in code?
</pre>
</blockquote>
<pre wrap=""><!---->
No, that is not possible. I once tried to change move and fillchar to use "out" parameters instead of "var" parameters, and the result was all sorts of crashes. The reason is that "out" has special semantics for reference counted types (they are finalized at the *caller* side), and move/fillchar are sometimes used to zero uninitialised data (so if the run time then tries to finalise garbage, you get crashes).
</pre>
</blockquote>
In that case I suspect an implementation insect. The
compiler/codegenerator should not differ between var and out, just the
parser should distinguish imho. A reference should never influence
"reference counting" and should surely not have anything to do with
finalisation at all, not even because copy on. Most other languages
behave like that I think. What is the reason FPC differs?<br>
</body>
</html>