+ 1

What the preprocesor '#if 0' and '#if 1' mean?

Ex. #if 0 // some code... // ... #endif #if 1 // some code... // ... #endif

7th Dec 2016, 9:08 AM
Aris Sugiarto
Aris Sugiarto - avatar
1 Answer
+ 2
The #if .... #endif part of code is being COMPILED if the #if is true. In your example #if 0 is the same as #if false, becouse when we convert int to bool every value but 0 is true.This means that somecode1 won't be a part of your code. The same for #if 1 -> #if true, this time #if returns true so it will be included in your program. Sory for my english, I'm not a native speaker.
7th Dec 2016, 4:36 PM
Maciej Falbogowski
Maciej Falbogowski - avatar