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?
Consider the following code:
#ifdef foo
foo();
#endif
If you want a snippet like the above to call function foo
, you need to define foo
. However, if you just
#define 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
then the first snippet will preprocess to foo();
as it should.
Trick to ensure #if defined(__arch_swahb32)
passes but doesn't replace. (Often used to implement macro type functions)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.