[fpc-devel] Redefine FillChar() to use out parameter instead

Martin lazarus at mfriebe.de
Thu Nov 19 11:41:57 CET 2009


Jonas Maebe wrote:
>
> On 19 Nov 2009, at 11:21, Alexander Klenin wrote:
>>> Well in this case, the code is actually positively affected by the 
>>> "out"
>>> param (because it avoids the mem leak)
>>
>> Jonas, can you confirm that your example is incorrect one,
>> and Martin's example below is actually what you meant?
>
> Why do you think my example is incorrect? It currently runs without a 
> memory leak, and would result in a memory leak if the semantics of 
> "out" would be changed from "parameters are automatically finalized at 
> the caller side" into "no finalization is performed".
>
> You did ask for an example where changing the semantics of "out" would 
> change the behaviour of existing code, didn't you?

Jonas is right, but...

I think it got confusing. The thread changed from: "redefine filchar to 
use out" to "change the behaviour of out, so fillchar can use it"

Jonas example applies to "change the behaviour of out, so fillchar can 
use it"
My example applies to "redefine filchar to use out"

Martin



More information about the fpc-devel mailing list