Forum
Variables with random data in - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15)
+---- Thread: Variables with random data in (/showthread.php?tid=421)



Variables with random data in - britlion - 01-29-2012

Not sure if it's a bug or design, but I seem to be finding random numbers in dimensioned arrays. I would have expected a DIM to set values to zero by default, I think?

Assuming that, and not looping through and setting them to zero is causing some very surprising values to pop up!


Re: Variables with random data in - boriel - 01-29-2012

britlion Wrote:Not sure if it's a bug or design, but I seem to be finding random numbers in dimensioned arrays. I would have expected a DIM to set values to zero by default, I think?

Assuming that, and not looping through and setting them to zero is causing some very surprising values to pop up!
They should be Zero. Can you post some (minimal) sample code?


Re: Variables with random data in - britlion - 01-30-2012

It could be me. I put in deliberate loops to write zero to the array, and I'm still seeing odd numbers.

Now I have to find out where's writing to that variable! (or prove there's an error somewhere else, like corrupted memory) I'll get back to you on it.