memcopy problem..

BlitzMax Forums/BlitzMax Programming/memcopy problem..

NoOdle(Posted 2009) [#1]
When i try and run this i get an Unhandled Exception: Attempt to index array element beyond array length

Other people however have said that this works fine for them... am i doing something wrong?

Ive tried both BM V1.33 and V1.34..




Thanks for any help :)


Jesse(Posted 2009) [#2]
when you create marf it does not create the empty space for it. when you try to memcopy it attempts to copy it in to a non existing space and that is why you get an error.
note the error only appears in debug mode, release mode writes to an elegal address and can eventually crash your computer.
you can fix it by giving a size to Marf:
local Marf:float[3]



NoOdle(Posted 2009) [#3]
ok thanks alot for that, I was confused why it worked for some and not for others.

Ive also just noticed that i can do Marf = Arf and i wouldnt need to give a size to Marf, am i correct in assuming this?


Brucey(Posted 2009) [#4]
Ive also just noticed that i can do Marf = Arf

Except that Marf and Arf would point to the same memory location.

If that is what you wanted all along, then that's the way to do it.


NoOdle(Posted 2009) [#5]
yeah thats what im after thanks for the help :)