Quantcast
Channel: MSBuild forum
Viewing all articles
Browse latest Browse all 2763

False warning C4389 with Microsoft compiler

$
0
0

 UINT uLong = 0;
 WORD byVal = 1;
 WORD byVal1 = 3;
 
 if (uLong != (byVal * byVal1))
 {
  printf("Correct");
 }
 else
 {
  printf("Incorrect");
 }

Above code gives me "warning C4389: '!=' : signed/unsigned mismatch"

As all the variables involved in expression are unsigned how can it result in this warning. BTW this happens only on Microsoft compiler and not on GCC.

Is it a bug in Microsoft compiler, if not can anyone let me know how to fix this in my code?

I am using Microsoft Visual Studio Premium Version 12.0.21005.1 REL.

Thanks & Regards,

Amit Kulkarni.


Viewing all articles
Browse latest Browse all 2763


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>