/******** * If the code is run with NO_WORKIE 0 then the output is * * j: 0 Hello World 0 * j: 0 Hello World 1 * j: 0 Hello World 2 * j: 0 Hello World 3 * j: 0 Hello World 4 * * j: 2 Hello World 0 * j: 2 Hello World 1 * j: 2 Hello World 2 * j: 2 Hello World 3 * j: 2 Hello World 4 * * If the code is run with NO_WORKIE 1 then there is no output! * * The only difference being how the array of bool are declared. * */ #define NO_WORKIE 0 void bug1() { #if NO_WORKIE bool first_check[4] = {false, true, true, true}; bool second_check[5] = {true, true, true, true, true}; #else bool first_check[4]; first_check[0] = false; first_check[1] = true; first_check[2] = false; first_check[3] = true; bool second_check[5]; second_check[0] = true; second_check[1] = true; second_check[2] = true; second_check[3] = true; second_check[4] = true; #endif for(int j = 0; j < 4; j++) { if(first_check[j]) continue; for(int i = 0; i < 5; i++) { printf("j: %d ", j); if(second_check[i] && i == 0) { printf("Hello World %d\n", i); } else if(second_check[i] && i == 1) { printf("Hello World %d\n", i); } else if(second_check[i] && i == 2) { printf("Hello World %d\n", i); } else if(second_check[i] && i == 3) { printf("Hello World %d\n", i); } else if(second_check[i] && i == 4) { printf("Hello World %d\n\n", i); } } } }