This is not guaranteed but most compilers of good quality will do it.
C99 Rationale says in 6.4.9:
if (0) {
/* code to be excluded */
}
Many modern compilers will generate no code for this if statement.
For example with gcc
(in C) an assembly dump shows that dead code with either if (0) .. else
or if (1) .. else
is optimized out even in -O0
.