Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#elif defined without parentheses

Using VS2005 with BLAH_BLAH defined the following preprocessor conditional is false:

#elif defined BLAH_BLAH

but if I change it to

#elif defined(BLAH_BLAH)

it is true.

Why do the parentheses make a difference here?

like image 998
insipid Avatar asked Mar 07 '11 18:03

insipid


2 Answers

It shouldn't make any difference, unless BLAH_BLAH is defined as something funny.

like image 102
Bo Persson Avatar answered Nov 16 '22 23:11

Bo Persson


The header file was created with a linux editor and added to the project with "Add Existing", after creating the file in the VS editor it evaluates to true. Must be a LF/CR issue?

like image 41
insipid Avatar answered Nov 16 '22 23:11

insipid