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

"Vinzent Höfler" JeLlyFish.software at gmx.net
Thu Nov 19 22:55:27 CET 2009

Florian Klaempfl <florian at freepascal.org>:

> Because a VAROUT parameter would be simply overwritten by the callee
> even if it contains a valid automated type:

That's a semantic definition, not an explanation. IOW: What stops you from selecting to implement the proper semantics depending on the type?

(Especially when introducing another new keyword for exactly clarifying intended semantics?)

> OUT does prevent this because s is cleaned up before p is entered. OTOH,
> OUT causes a crash if s is filled with garbage.

Assuming that one doesn't play with pointers and typecasts a lot, the probability of an automated type containing garbage should be rather low.

Nonetheless, I still consider a

"FillAnyArrayWithZeros (out X : DynamicArray)"

which deletes the whole array instead of filling it up to it's defined size with zeros rather counterintuitive. I expect the single array elements to contain garbage (which I want to clean out), not the defined array itself...


GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

More information about the fpc-devel mailing list