Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
*NEW*
Current Version on
STEAM
:
16.026
Logfile:
EN
,
DE
Webchat:
Visit the chat
Home
Help
Search
Login
Register
GLBasic forum
»
Main forum
»
GLBasic - en
»
Array Overflow or Out Of bounds Error?
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Array Overflow or Out Of bounds Error? (Read 2283 times)
Stevester
Mc. Print
Posts: 12
Array Overflow or Out Of bounds Error?
«
on:
2011-Aug-10 »
Hi, as a new user I'm finding myself caught out every now and again with my programs exiting without warning.
On investigation its generally been down to me exceeding the array limits such as trying to stick a number in px[10] when it is only defined to px(0-9).
I've managed to sort this out in each case but was wondering why I'm not getting an 'out of bound's or 'array overflow' error pointing at the offending line of code. It would save a lot of time tracing through the program if it pointed straight to the problem area. Am I missing something in settings or debug that does this?
Many thanks,
Logged
Minion
Mr. Polyvector
Posts: 229
Re: Array Overflow or Out Of bounds Error?
«
Reply #1 on:
2011-Aug-10 »
Have you tried using debug when compiling ? I find that helps with array overflow (tells me what array has blown, and the whereabouts in the code)
Logged
Stevester
Mc. Print
Posts: 12
Re: Array Overflow or Out Of bounds Error?
«
Reply #2 on:
2011-Aug-10 »
Thanks for the reply Minion,
I haven't - will have a play with the debug commands tonight. The blown array location in the code is exactly what I'm after.
Even in relatively small programs its not always apparent what the issue is and takes some time to sift through the code.
Cheers.
Logged
Moebius
Dr. Type
Posts: 315
Re: Array Overflow or Out Of bounds Error?
«
Reply #3 on:
2011-Aug-10 »
If you have debug mode enabled (Compiler->Debug Mode) then the IDE jumps to the line the program crashed on from an out of index error.
Logged
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary
hardyx
Community Developer
Prof. Inline
Posts: 505
Re: Array Overflow or Out Of bounds Error?
«
Reply #4 on:
2011-Aug-10 »
You don't get "Out of bounds" error messages because GLBasic compiles to C++ code, and this last language not checks for out of bounds in arrays and overflow errors in operations. Is very fast and good for make fast games and generate code for devices like consoles and phones. All runtime checks degrades performance in a game with many objects moving arround the screen.
«
Last Edit: 2011-Aug-10 by hardyx
»
Logged
Mi blog Bits de Ocio
mentalthink
Prof. Inline
Posts: 3375
Integrated Brain
Re: Array Overflow or Out Of bounds Error?
«
Reply #5 on:
2011-Aug-11 »
The best way for don“t have troubles whit arrays is :
LEN(myArray[])-1
Whit this never execededs the limits of your array.
Logged
Kitty Hello
code monkey
Administrator
Prof. Inline
Posts: 10851
here on my island the sea says 'hello'
Re: Array Overflow or Out Of bounds Error?
«
Reply #6 on:
2011-Aug-16 »
The "out of bounds" is detected on release, too. But the program just exits.
With the debug mode enabled, the errorlog is read. Also, the debug version drops a line about what index you wanted to access.
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
GLBasic forum
»
Main forum
»
GLBasic - en
»
Array Overflow or Out Of bounds Error?