Jay Taylor's notes

back to listing index

Why does the C preprocessor interpret the word "linux" as the constant "1"? - Stack Overflow

[web search]
Original source (stackoverflow.com)
Tags: programming linux c prepocessor unix vax gcc stackoverflow.com
Clipped on: 2013-10-09

Why does the C preprocessor in GCC interpret the word linux (small letters) as the constant 1?

test.c:

#include <stdio.h>int main(void){           int linux = 5;    return 0;}

Result of $ gcc -E test.c (stop after the preprocessing stage):

....int main(void){    int 1 = 5;    return 0;}

Which -of course- yields an error.

(BTW: There is no #define linux in the stdio.h file.)

Image (Asset 1/7) alt=