-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong evaluation of 0+number #7
Comments
Ideas? |
This is because it only checks the first token(I am not sure why it would work on MSVC): NOT(0+0) // Expands to 1
NOT(0+1) // Expands to 1
NOT(0 1) // Expands to 1
NOT(0) // Expands to 1 You can update #define PAREN() ()
#define IS_EMPTY(x) IS_PAREN(PAREN x ())
#define EAT_0
#define NOT(x) BITAND(CHECK(PRIMITIVE_CAT(NOT_, x)))(IS_EMPTY(PRIMITIVE_CAT(EAT_, x)))
#define NOT_0 PROBE(~) So now it will result in this: NOT(0+0) // Expands to 0
NOT(0+1) // Expands to 0
NOT(0 1) // Expands to 0
NOT(0) // Expands to 1 |
Hmmm I see. I was thinking about if I could exploit the preprocessor to transform a |
Well the preprocessor cant parse symbols, so I dont think it would be possible. |
Hello @pfultz2 ,
Ty for the wiki doc. Very illustrative! :)
I found that this program fails in both gcc & clang. Works ok in VS.
The text was updated successfully, but these errors were encountered: