Возм проблема с компилятором
Приветствую. Занимаясь в свободное время пувнерством, решил устроить дичь.
Мод компилируется без проблем, но при выводе в консоль, cellmax будет показываться в двух переменных.
Но загруженность памяти у переменной pos_r будет меньше чем у pos_x[0]
new pos_r = cellmax char;
Header size: 172 bytes
Code size: 92 bytes
Data size: 4 bytes
Stack
/heap size
: 16384 bytes
; estimated
max. usage
=9 cells
(36 bytes
)Total requirements: 16652 bytes
new pos_x[1 char];
pos_x[0] = cellmax; // Выбивает cellmax
Header size: 172 bytes
Code size: 128 bytes
Data size: 4 bytes
Stack
/heap size
: 16384 bytes
; estimated
max. usage
=9 cells
(36 bytes
)Total requirements: 16688 bytes
new pos_x[1 char];
pos_x{0} = cellmax; // Выбивает 255
Header size: 172 bytes
Code size: 140 bytes
Data size: 4 bytes
Stack
/heap size
: 16384 bytes
; estimated
max. usage
=9 cells
(36 bytes
)Total requirements: 16700 bytes
new pos_x[1];
pos_x{0} = cellmax; // Выбивает 255
Header size: 172 bytes
Code size: 140 bytes
Data size: 4 bytes
Stack
/heap size
: 16384 bytes
; estimated
max. usage
=9 cells
(36 bytes
)Total requirements: 16700 bytes
Продолжим:
new pos_r[2 char];
pos_r[0] = cellmax;
pos_r[1] = cellmax; //error 032: array index out of bounds (variable "pos_r") (Выбивает на эту строку ошибку)
// Посмотрев код выше, у нас схож действие было и не выбивало ошибку.
new pos_r_1,
pos_r_2;
pos_r_1 = cellmax;
pos_r_2 = cellmax;
Header size: 172 bytes
Code size: 148 bytes
Data size: 4 bytes
Stack
/heap size
: 16384 bytes
; estimated
max. usage
=9 cells
(36 bytes
)Total requirements: 16708 bytes
new pos_r[2];
pos_r{0} = cellmax;
pos_r{1} = cellmax;
Header size: 172 bytes
Code size: 196 bytes
Data size: 4 bytes
Stack
/heap size
: 16384 bytes
; estimated
max. usage
=9 cells
(36 bytes
)Total requirements: 16756 bytes
new pos_r[2 char];
pos_r{0} = cellmax;
pos_r{1} = cellmax;
Header size: 172 bytes
Code size: 196 bytes
Data size: 4 bytes
Stack
/heap size
: 16384 bytes
; estimated
max. usage
=9 cells
(36 bytes
)Total requirements: 16756 bytes
new pos_r[2];
pos_r[0] = cellmax;
pos_r[1] = cellmax;
Header size: 172 bytes
Code size: 172 bytes
Data size: 4 bytes
Stack
/heap size
: 16384 bytes
; estimated
max. usage
=9 cells
(36 bytes
)Total requirements: 16732 bytes
Также ещё:
new Float:pos_r[3 char];
printf("%02.f", pos_r
{2}); // Не выбивает ошибки
Но при:
new Float:pos_r[3 char];
printf("%02.f", pos_r
[1]); //error 032: array index out of bounds (variable "pos_r") printf("%02.f", pos_r
[2]); //error 032: array index out of bounds (variable "pos_r")
Меня интересует - либо это баг компилятора, либо я - туту паровоз