Why does the C preprocessor interpret the word “linux” as the constant “1”?

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.)

5 s
5

Leave a Comment