<分区>
在/usr/include/asm/swab.h 中,我找到了以下代码:
static __inline__ __u32 __arch_swab32(__u32 val)
{
__asm__("bswapl %0" : "=r" (val) : "0" (val));
return val;
}
#define __arch_swab32 __arch_swab32
最后一行是什么意思,定义一个名称本身?
<分区>
在/usr/include/asm/swab.h 中,我找到了以下代码:
static __inline__ __u32 __arch_swab32(__u32 val)
{
__asm__("bswapl %0" : "=r" (val) : "0" (val));
return val;
}
#define __arch_swab32 __arch_swab32
最后一行是什么意思,定义一个名称本身?
最佳答案
这叫做 self-referentitial macro :
One common, useful use of self-reference is to create a macro which expands to itself. If you write
#define EPERM EPERM
then the macro
EPERM
expands toEPERM
. Effectively, it is left alone by the preprocessor whenever it's used in running text. You can tell that it's a macro with#ifdef
. You might do this if you want to define numeric constants with anenum
, but have#ifdef
be true for each constant.
关于c - 这样的定义 "#define __arch_swab32 __arch_swab32"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45857532/