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*

17
  • 5
    @JesseChisholm, did you check your C++11 version? I cannot make it work on GCC 4.8.1, 4.9.1, 5.3.0. It says {{missing binary operator before token "("}} on {{#if 0 == c_strmp/*here*/( USER, QUEEN )}} Commented Jul 20, 2016 at 16:53
  • 3
    @JesseChisholm So I managed to compile your C++11 example if I change #if 0 == c_strcmp( USER, JACK ) to constexpr int comp1 = c_strcmp( USER, JACK ); #if 0 == comp1 Commented Jul 20, 2016 at 17:12
  • 4
    @JesseChisholm, hmm, still no luck. Any constexpr variable equals zero in #if.Your example works only because USER is JACK. If USER was QUEEN, it would say USER IS QUEEN and USER_VS IS QUEEN Commented Jul 20, 2016 at 19:31
  • 14
    This c++11 part of this answer is wrong. You can't call functions (even constexpr) from preprocessor directives. Commented Apr 29, 2018 at 12:49
  • 13
    This flat-out wrong answer has already misled someone who referenced it. You can't call a constexpr function from the preprocessor; constexpr isn't even recognized as a keyword until translation phase 7. Preprocessing is done in translation phase 4. Commented Apr 29, 2018 at 17:09