AnsweredAssumed Answered

? operator warning

Question asked by markul hu on Apr 8, 2015
Latest reply on Apr 8, 2015 by markul hu

signed char X1,X2,X3;

X3 = (X1 > X2)? 127: -128;

When i compile this code, the compiler display warning message said "possible lost of data".

But compile the code "X3 = (X1 > X2)? 127: -127;" is ok.

 

So do that "signed short" with -32768, and "signed long" with -2147483648

 

Why? Is this a compiler's Bug?

Outcomes