为什么有人会使用#if 1 C预处理程序指令? [英] Why would somebody use an #if 1 C preprocessor directive?
本文介绍了为什么有人会使用#if 1 C预处理程序指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在查看一些 C 源代码,但我听不懂以下部分
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
为什么有人会这样做 #if 1
?
Why would someone do #if 1
? Isn't it true that only the first block will ever be processed?
推荐答案
是。..仅第一个块会被处理吗? ---直到有人将1更改为0。然后将编译另一个块。这是在测试不同算法时临时切入和切出代码块的便捷方法。
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.
这篇关于为什么有人会使用#if 1 C预处理程序指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文