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]

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


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