is there a way to disable error C4146 in Microsoft Visual Studio 2015 - express edition? I tried to set "Treat warnings as errors" option to no, however MSVC still treats C4146 as error. Is there any solution to this?
unary minus operator applied to unsigned type, result still unsigned Unsigned types can hold only non-negative values, so unary minus (negation) does not usually make sense when applied to an unsigned type. Both the operand and the result are non-negative.
error C4146: unary minus operator applied to unsigned type, result still unsigned Specifically, it is in darts.h, line 189. I built again in Visual Studio 2015 then there is no error. How can I fix this in Visual Studio 2013? What is the type of value_? And array_type_ is defined as?
Unary minus is applied to the unsigned value, with an unsigned result, which also happens to be 2147483648. The unsigned type of the result can cause unexpected behavior.
An unsigned value is unchanged by the unary negation operator. This warning often occurs when you try to express the minimum int value, -2147483648, or the minimum long long value, -9223372036854775808. These values can't be written as -2147483648 or -9223372036854775808ll, respectively.
"SDL checks" is set to to "Yes (/sdl)" by default settings for a new Microsoft Visual Studio Community Edition project. This turns certain "security relevant" warnings into errors. Set the parameter to "No (/sdl-)", to turn them back to warnings.
See Microsoft documentation on "SDL Check", currently here.
Edit: The question was already answered in comments, but I missed the answer because of the long thread.
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