What exactly does an #if 0 ..... #endif block do?

c-preprocessor

Solution

Not only does it not get executed, it doesn't even get compiled.

`#if` is a preprocessor command, which gets evaluated before the actual compilation step. The code inside that block doesn't appear in the compiled binary.

It's often used for temporarily removing segments of code with the intention of turning them back on later.

Problem

In C/C++ What happens to code placed between an `#if 0`/`#endif` block? ``` #if 0 //Code goes here #endif ``` Does the code simply get skipped and therefore does not get executed?

Original source

Related problems