This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C preprocessor problem


hi all,

I am trying to use -undef C preprocessor option.
I am interested to know whether my knowlege about this option is correct or
not.

/*c_test.c*/
int main()
{
   int x ;

   x = CMD_SYM;

   return x;
}

I preprocessesed this file with following command line options

cpp -DCMD_SYM=10 -undef c_test.c

This produced following output on stdout

# 2 "c_test.c"
int main()
{
   int x ;

   x = 10;					

   return x;
}

Now my question is why CMD_SYM symbol is getting replaced with 10 though I
have
given command line option " -undef " to decable such predefined definitions.

GNU manual says about -undef as follows


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]