[fpc-other] Resizing dynamic arrays always zeroes new mem
Geno Roupsky
groupsky at gmail.com
Tue Mar 14 15:11:07 CET 2006
Hi,
I was making a small program using dynamic arrays and at one point
started to wonder is it always guaranteed that the new memory will be
zeroed. I mean if we have a snippet like this:
[snip]
var
a: array of integer;
begin
setlength(a, 10);
// all 10 elements are 0
setlength(a, 60);
// again all 60 elements are 0
end;
[/snip]
I don't find this as a bug but checking at the documentation
http://www.freepascal.org/docs-html/ref/refsu14.html#x36-410003.3.1
there is no mentioning of this feature.
So finally my question is: Is this behaviour sure to stay in which
case I would ask to be mentioned in the docs or is it better not to
rely on it - again best to mention it in the docs?
--
Geno Roupsky
More information about the fpc-other
mailing list