[fpc-devel] Redefine FillChar() to use out parameter instead
Martin
lazarus at mfriebe.de
Thu Nov 19 11:50:31 CET 2009
Graeme Geldenhuys wrote:
> Paul Ishenin wrote:
>
>> Compiler will add a flag for each var/const argument that they dont
>> require that checks.
>>
>
> Can't the compiler simply initialize structured types by default?
> Initialize char arrays to empty strings, other structures like pointers
> to nil, byte arrays to #0 etc..?
>
> After all, this is already done for AnsString, Integer type, real types
> etc...
>
I thought it does that?
But FillChar is the same lowlevel like move. (IMHO)
Move doesn't care about ref-counts. And if you use move, you must start
to take care of refcounts yourself. Ani if you have to care about them,
you need a fillchar that doesn't affect them....
But we start discussing 2 different unctiuons
FillChar
FillcharWithPreFinalization
they do differrent things, both have a use case.
The initial problem of this thread was not: Fillchar doesn't finalize
ref-counted types
It was about the hints.
What is wanted is a Fillchar (that does not care about ref-counts, as it
is currently) but that does not hint neither. => that is behaviour of a
var param, but without hint.
If you want Fillchar with previous finalization of ref counted types,
then FillChar is not the function you need.
Fillchar is as lowlevel as move / and I wonder: does move give hints
too, if the targer is not initalized?
Martin
More information about the fpc-devel
mailing list