为什么Linux内核#将符号本身定义为? [英] Why does the Linux kernel #define a symbol as itself?
本文介绍了为什么Linux内核#将符号本身定义为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
In the Linux kernel, there can be found a line of code that looks redundant to me:
#define __arch_swahb32 __arch_swahb32
这种成语的目的是什么?
What is the purpose of an idiom like this?
推荐答案
请考虑以下代码:
#ifdef foo
foo();
#endif
如果要让上述片段调用函数foo
,则需要定义foo
.但是,如果您只是
If you want a snippet like the above to call function foo
, you need to define foo
. However, if you just
#define foo
然后将功能foo
名称替换为空标记,并且将第一个代码段预处理为仅();
.但是,如果您
then the function foo
name will be replaced with an empty token, and the first snippet is preprocessed to just ();
. If, however, you
#define foo foo
然后,第一个代码段将按需要预处理为foo();
.
then the first snippet will preprocess to foo();
as it should.
这篇关于为什么Linux内核#将符号本身定义为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文