runtime pawn bug
#1

I don't really know if it's an unknow bug, but I just found it so I wanna share and get your opinion guys

PHP код:
#include        <a_samp>
new TesteVar[5][3];
public 
OnGameModeInit()
{
    for(new 
0100i++)
        
printf("TesteVar[%d][0] = %d"iTesteVar[i][0]);

if you compile that on -d 0, it won't break by runtime error on right place
that was my console output:
Quote:

[15/11/13 13:11:25] TesteVar[0][0] = 0
[15/11/13 13:11:25] TesteVar[1][0] = 0
[15/11/13 13:11:25] TesteVar[2][0] = 0
[15/11/13 13:11:25] TesteVar[3][0] = 0
[15/11/13 13:11:25] TesteVar[4][0] = 0
[15/11/13 13:11:25] TesteVar[5][0] = 0
[15/11/13 13:11:25] TesteVar[6][0] = 0
[15/11/13 13:11:25] TesteVar[7][0] = 0
[15/11/13 13:11:25] TesteVar[8][0] = 0
[15/11/13 13:11:25] TesteVar[9][0] = 0
[15/11/13 13:11:25] TesteVar[10][0] = 0
[15/11/13 13:11:25] TesteVar[11][0] = 0
[15/11/13 13:11:25] TesteVar[12][0] = 0
[15/11/13 13:11:25] TesteVar[13][0] = 0
[15/11/13 13:11:25] TesteVar[14][0] = 0
[15/11/13 13:11:25] TesteVar[15][0] = 0
[15/11/13 13:11:25] TesteVar[16][0] = 0
[15/11/13 13:11:25] TesteVar[17][0] = 0
[15/11/13 13:11:25] TesteVar[18][0] = 0
[15/11/13 13:11:25] TesteVar[19][0] = 0
[15/11/13 13:11:25] TesteVar[20][0] = 0
[15/11/13 13:11:25] TesteVar[21][0] = 0
[15/11/13 13:11:25] TesteVar[22][0] = 0
[15/11/13 13:11:25] TesteVar[23][0] = 0
[15/11/13 13:11:25] TesteVar[24][0] = 0
[15/11/13 13:11:25] TesteVar[25][0] = 0
[15/11/13 13:11:25] TesteVar[26][0] = 0
[15/11/13 13:11:25] TesteVar[27][0] = 0
[15/11/13 13:11:25] TesteVar[28][0] = 0
[15/11/13 13:11:25] TesteVar[29][0] = 1677721600
[15/11/13 13:11:25] TesteVar[30][0] = 0
[15/11/13 13:11:25] TesteVar[31][0] = 0
[15/11/13 13:11:25] TesteVar[32][0] = 0
[15/11/13 13:11:25] TesteVar[33][0] = 0
[15/11/13 13:11:25] TesteVar[34][0] = 0
[15/11/13 13:11:25] TesteVar[35][0] = 0
[15/11/13 13:11:25] TesteVar[36][0] = 0
[15/11/13 13:11:25] TesteVar[37][0] = 0
[15/11/13 13:11:25] TesteVar[38][0] = 0
[15/11/13 13:11:25] TesteVar[39][0] = 0
[15/11/13 13:11:25] TesteVar[40][0] = 0


and if you compile that with -d 2, it breaks by runtime error on right place:
Quote:

[15/11/13 13:14:13] TesteVar[0][0] = 0
[15/11/13 13:14:13] TesteVar[1][0] = 0
[15/11/13 13:14:13] TesteVar[2][0] = 0
[15/11/13 13:14:13] TesteVar[3][0] = 0
[15/11/13 13:14:13] TesteVar[4][0] = 0

Reply
#2

The array you create is only 5 elements large in the first-dimension, yet you try to access values larger than the size. I don't know what you were expecting but you can't access array values that do not exist in an array.
Reply
#3

Quote:
Originally Posted by Memoryz
Посмотреть сообщение
The array you create is only 5 elements large in the first-dimension, yet you try to access values larger than the size. I don't know what you were expecting but you can't access array values that do not exist in an array.
He knows that, what he tried to say is that compiling with -d2 breaks (stops) the code (in this case the loop) from continuing accessing the element at an invalid index while compiling with -d0 doesn't stop the code and it keeps looping with all the invalid indexes.
Reply
#4

Quote:
Originally Posted by Memoryz
Посмотреть сообщение
The array you create is only 5 elements large in the first-dimension, yet you try to access values larger than the size. I don't know what you were expecting but you can't access array values that do not exist in an array.
wtf !?
which one?
1) my english is so bad?
2) can't you read?
3) are you re**** ?


Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
He knows that, what he tried to say is that compiling with -d2 breaks (stops) the code (in this case the loop) from continuing accessing the element at an invalid index while compiling with -d0 doesn't stop the code and it keeps looping with all the invalid indexes.
yeah...
the worst part is if you change values on loop to index > 5, it will change some "random" (I know it's not really random) value on memory, of any other var on the gamemode!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)