Why does the preprocessor process code in #if 0 ?

Chirayu Patel chirayuATelwing.trillium.com
Thu Sep 16 10:14:00 GMT 1999


I came across the following program and discovered that gcc preprocessor
processes code in the #if 0 section also. (The compiler does not compile it
though).

I looked up in K&R but section A12.5 says that code in #if 0 is to be 
discarded. Is this a bug in gcc or am I missing something.

The program I tried is

---------------------------------------
#include <stdio.h>
main()
{
char a[80] = {
/*
         with no proper termination\n"
#else
     " This is a very long string and \
         with proper termination\n"
#endif

};
printf ("%s\n",a);
}
---------------------------------------

Chirayu
}             


More information about the Gcc-help mailing list