behavior of -D=FOO
John Love-Jensen
eljay@adobe.com
Wed Dec 7 17:23:00 GMT 2005
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."
More information about the Gcc-help
mailing list