[fpc-devel] Redefine FillChar() to use out parameter instead
jonas.maebe at elis.ugent.be
Tue Nov 17 13:14:38 CET 2009
On 17 Nov 2009, at 12:04, Graeme Geldenhuys wrote:
> 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?
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).
More information about the fpc-devel