Array boundaries
BlitzMax Forums/BlitzMax Beginners Area/Array boundaries
| ||
This is a hypothetical question, but say, I have the following array: Local test:int[10,10] - What happens when a program doesn't properly check for the bounds of an array, and tries to write to test[12,12] , or test[-1,-2] for example? - Will the invalid assignment just get ignored? - Will it extend the size of the array to include these cells? - Will random bits of RAM get overwritten by this information? (buffer overflow) ? Obviously it is important to do proper bounds checking when writing data, but it would be good to know what the impact could be if something does happen to get... misplaced. I looked around in the docs, but didn't see anything that would shed light on this. |
| ||
From a quick test the invalid assignment is ignored. |
| ||
It's hard to tell the difference between being ignored and ending up writing to random other memory locations, so it's important to know for certain. :-) random data in memory can lead to unexpected side effects, crashes, etc. |
| ||
Hi, It should generate an error in debug mode, but will write to non-existant mem in release mode (not a good thing). |