Why would somebody use an #if 1 C preprocessor directive?

c-preprocessor, preprocessor-directive

Solution

Yes.. Only the first block will be processed --- until someone changes the 1 to a 0. Then the other block will be compiled. This is a convenient way to temporary switch blocks of code in and out while testing different algorithms.

Problem

I am looking through some C source code and I don't understand the following part ``` #if 1 typedef unsigned short PronId; typedef unsigned short LMId; # define LM_NGRAM_INT #else typedef unsigned int LMId; typedef unsigned int PronId; # undef LM_NGRAM_INT #endif ``` Why would someone do `#if 1`? Isn't it true that only the first block will ever be processed?

Original source