This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: behavior of -D=FOO
- From: John Love-Jensen <eljay at adobe dot com>
- To: Marty Leisner <mleisner at eng dot mc dot xerox dot com>, MSX to GCC <gcc-help at gcc dot gnu dot org>
- Date: Wed, 07 Dec 2005 11:22:44 -0600
- Subject: Re: behavior of -D=FOO
Hi Marty,
Looks like 2.95.x treats it as an error (attempting to define a 0-length
identifier), but 3.x and 4.x accept it.
Notice this effect:
touch test.cpp
g++ -E -dM -D=FOO\ 3 test.cpp | grep FOO
In 3.x and 4.x:
#define FOO 3
Hmm!
Reading the documentation carefully, it appears that:
-DFOO
-DFOO=3
is preferred, and
-D FOO
-D FOO=3
is acceptable. At least with 3.x and 4.x.
I'm willing to bet that this:
-D=FOO\ 3
is probably frowned upon, and I'd consider it a "negative testing"
(artifact) bug against the command line parser.
Sincerely,
--Eljay
"I hate the preprocessor."