Just checking ... new arrays are zeroed right?

BlitzMax Forums/BlitzMax Beginners Area/Just checking ... new arrays are zeroed right?

Grey Alien(Posted 2006) [#1]
well the title says it all, if I declare myarray[10], the contents will always be 0 in each array slot won't they? I ask because in Delphi this is not the case (or maybe I'm thinking about when you declare a space of memory, it doesn't clean it out for you).


Perturbatio(Posted 2006) [#2]
yes


Dreamora(Posted 2006) [#3]
0 for numerics, "" for strings and null for objects to be more specific.


Grey Alien(Posted 2006) [#4]
lovely, thought so, thanks.


H&K(Posted 2006) [#5]
hahah, yep Grey Myarray:int[10]
lol


Steve Elliott(Posted 2006) [#6]
I always get paranoid about things like this, so tend to set to 0 with a for loop.


SculptureOfSoul(Posted 2006) [#7]
Guys, it only takes like 30 seconds to make a test program and put your mind to ease. :)


Dreamora(Posted 2006) [#8]
Yupp but that does not say anything.

Just because something is like that once it does not mean that it is always like that or that other systems behave the same.

"proofing by testing" is nonsense :-)


H&K(Posted 2006) [#9]
Guys, it only takes like 30 seconds to make a test program and put your mind to ease. :)


Ahh, but for example that flip thing that "somethimes" gives you the last screen, but not always. Thats just the sort of thing where testing is brill


Grey Alien(Posted 2006) [#10]
Guys, it only takes like 30 seconds to make a test program and put your mind to ease. :)
correct however, In Delphi if you made a test app and looked at the memory, depending on what it was used for before it may all be zeros. Run the test later in the day and it could be filled with junk. The Delphi manuals state for sure that it is already zeroed so I thought I'd ask on the forums as a quick way to hopefully get a definitive answer.


Steve Elliott(Posted 2006) [#11]
You got a definitive answer - but it's not adviseable to do it. ;-)