You can check array bounds manually:AndrewGrant wrote:That would be because of the patch I pushed yesterday... to allow indexing that array when in check (which means depth could be < 0).
I'm surprised I don't get these errors when I run my program through valgrind / gdb
Code: Select all
assert(index >= 0);
assert(index < 64);
piece[index] = aPiece;
color[index] = aColor;
Code: Select all
#include <assert.h>
#include <stdlib.h>
#define single_dim_check( a, x ) ( (assert( (x >= 0 ) && (sizeof a / sizeof a[0] > x ) ) )
int main(void)
{
int a[5];
size_t index = 6;
single_dim_check(a,index);
return 0;
}