In Visual C++ you can temporarily disable a warning by using pragma:
#pragma warning(suppress: 4307)
How can I disable a warning within a macro, e.g., when I cause an "integral constant overflow" warning like this:
#define TIMES_A_MILLION(x) x * 1000000
int value = TIMES_A_MILLION(4711);
I don't want to repeat the warning at every place where the macro is used, but want the suppression to be part of the macro it self.
It is obviously not possible to do like this:
#define TIMES_A_MILLION(x) \
#pragma warning(suppress: 4307) \
x * 1000000
In your case you have to use the extension __pragma
__pragma
instead of
#pragma
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With