4 ms·
C arrays are nothing more than convenient pointer math. array[1024] = &array + sizeof(element) * index (in that case 1024). And while there is some weird post-f
by defaultname 5y ago
C arrays are nothing more than convenient pointer math. array[1024] = &array + sizeof(element) * index (in that case 1024). And while there is some weird post-facto "one past the end" bit in the standard (added long after Quake 3 was made), in any modern compiler you can happily get pointers for illegal indexes. If you have a literally sized array and a literal offset it could warn (e.g. Warray-bounds), but for the vast majority of cases it won't flag at all. Nor would this cause any runtime issues. Because it's just math.
And the truth is that without runtime memory protection you can dereference those illegal positions.