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?
Linux is a monolithic kernel while OS X (XNU) and Windows 7 use hybrid kernels.
Linux, in its nature, is not an operating system; it's a Kernel. The Kernel is part of the operating system – And the most crucial. For it to be an OS, it is supplied with GNU software and other additions giving us the name GNU/Linux. Linus Torvalds made Linux open source in 1992, one year after it's creation.
The UNIX operating system's development started in 1969, and its code was rewritten in C in 1972. The C language was actually created to move the UNIX kernel code from assembly to a higher level language, which would do the same tasks with fewer lines of code.
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.
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