I have the following line in my code
signed int test_case= -2147483648;
which generates the error:
C4146 unary minus operator applied to unsigned type, result still unsigned
but this is still with the data range of teh signed integer type:
__int32 signed, signed int, int –2,147,483,648 to 2,147,483,647
The strange things is assigning it as signed long gives this same error, i.e.
signed long test_case= -2147483648;
The changes below compile OK:
signed int test_case= -2147483647;
signed int test_case= 2147483649;
signed long test_case= -214748364800;
- Has anyone seen this issue with Visual Studio 2015 compiler?
- How is it defining the data types?
- How is the range checked?
- Why does it seem to ignore the "signed" assignment?
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…