Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 799
Peter Smit Avatar asked Feb 15 '10 13:02

Peter Smit


People also ask

Why do people put an instead of a?

A and an are two different forms of the same word: the indefinite article a that is used before noun phrases. Use a when the noun or adjective that comes next begins with a consonant sound. Use an when the noun or adjective that comes next begins with a vowel sound.

When should be used an?

"A" goes before words that begin with consonants. "An" goes before words that begin with vowels: an apricot. an egg.

Why does English use a and an?

A or an is the indefinite article. The form an is used before a word that starts with a vowel sound. The indefinite article is used with singular countable nouns: to refer to a person or a thing that you are mentioning for the first time in a conversation or a piece of writing.

What letters should you use an?

The rule is: Use an before a word beginning with a vowel sound (not letter). It doesn't matter how the word is spelled. It just matters how it is pronounced. Use a before a word with a consonant sound as well as y and w sounds.


1 Answers

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.

like image 121
James Curran Avatar answered Sep 18 '22 06:09

James Curran