In /usr/include/asm/swab.h I found following code:
static __inline__ __u32 __arch_swab32(__u32 val)
{
__asm__("bswapl %0" : "=r" (val) : "0" (val));
return val;
}
#define __arch_swab32 __arch_swab32
What is the meaning of the last line, defining a name as itself?
This is called 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With