Preprocessor operator ||

closed account (o1vk4iN6)
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?
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.
closed account (o1vk4iN6)
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.
Could it be RELEASE is already defined? Try undefining it first.
Topic archived. No new replies allowed.