Why does this work?

Blitz3D Forums/Blitz3D Programming/Why does this work?

This is odd. I size the bank to 2 and yet it doesnt make problems when i poke stuff way above 2. Here:

bn = CreateBank(2)

PokeByte bn,0,33
PokeInt bn,1, 2444
PokeInt bn,5, 2445
PokeInt bn,9, 2446

a0= PeekByte (bn,0)
a1= PeekInt (bn, 1)
a2= PeekInt (bn, 5)
a3= PeekInt (bn, 9)


bns = BankSize(bn)

Print bns
Print
Print a0
Print a1
Print a2
Print a3

WaitKey


Works perfectly well. Latest blitz3d version.

Run in debug mode and you will get an error.

This is similar behavior to arrays as well. That's why it's a good idea to run in debug mode now and then to help check for mistakes like that.

Oh. So if i compiled an unchecked exe and used it in a game, i would get memory corruption within the banks?

Didnt know that one.