You have an "error" in the switch structure: you can't have code outside of "case" or "default". Switch statements will jump to to one of the case and not execute code that isn't in a "case" or "default" statement.
The compiler should generate warnings if you didn't suppress them and if you used "Treat warnings as error" the code would not compile. Try adding /WX to your compiler flags and verify that there isn't a /wd4702 (disabling warning about unreachable code).
For example the following code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 | b32 test = false;
u32 a = 1;
switch ( a ) {
if ( test ) {
case 1: {
__debugbreak( );
} break;
case 2: {
__debugbreak( );
} break;
} else {
__debugbreak( );
}
}
|
Gives me the following error:
| error C2220: warning treated as error - no 'object' file generated
warning C4702: unreachable code
warning C4702: unreachable code
|
You should move the if outside of your switch that test which key was pressed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 | b32 test = false;
u32 a = 1;
if ( test ) {
switch ( a ) {
case 1: {
__debugbreak( );
} break;
case 2: {
__debugbreak( );
} break;
}
} else {
__debugbreak( );
}
|