Preprocessor operator ||
Feb 9, 2012 at 4:15am UTC
I seem to be having some troubles using the || operator with MSVC compiler.
1 2 3 4 5
#define RELEASE 2000
#if RELEASE < 1000 || RELEASE > 2000
#error "Unsupported"
#endif
The error is called in this case.
Also I've read '#error' is deprecated, what is the proper syntax if anyone knows?
Feb 9, 2012 at 4:53am UTC
Strange. The error is not triggered when I test your code with GCC.
Where have you heard that #error is deprecated? Maybe it's just a misunderstanding.
Feb 9, 2012 at 3:02pm UTC
I've read somewhere that #error was deprecated in C++ can't quite recall where it was.
It is strange, even though the above code doesn't appear to work the way I intend it to, this does:
1 2 3 4 5 6 7
#define RELEASE 2000
#if RELEASE < 1000
#elif RELEASE > 2000
#else
#error "Unsupported"
#endif
Which is why I'm curious to know if Microsoft doesn't support '||' in preprocessor if someone has a definite answer I can't seem to find any documentation regarding the matter.
Feb 9, 2012 at 7:06pm UTC
Could it be RELEASE is already defined? Try undefining it first.
Topic archived. No new replies allowed.