Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 8
    This is certainly not standard C, and I don't see how it would work with any compiler. The compiler can sometimes tell the results of expressions (even function calls, if they're inline), but not the pre-processor. Is your usage of $ some kind of pre-processor extension? Commented Feb 10, 2013 at 9:11
  • 3
    It looks like the '#if $USER_JACK == 0' syntax works, at least with GNU C++ used for building native Android code (JNI)... I did not know this, but it's very useful, thank you for telling us about it! Commented Jul 1, 2013 at 15:31
  • 7
    I tried this out on GCC 4.9.1, & I don't believe this will do what you think it does. While the code will compile, it won't give you the expected result. '$' is treated as a variable name. So the preprocessor is looking for '$USER_JACK' variable, not finding it & giving it the default value of 0. Thus, you will always have USER_VS defined as USER_QUEEN regardless of strcmp Commented Sep 5, 2014 at 18:34