The information in this article applies to:
SUMMARYIn the sample program below, two unsigned character variables are compared. The conditional always evaluates to true, even when x and y are complements. When examining the assembly code produced, it appears as though the compiler is generating code to compare two unsigned integers, not unsigned characters. Sample Code
The code generated in this case is correct. Operands of unsigned character
type are promoted to unsigned integer type when using arithmetic operators.
For this sample code to work as intended, cast the "~y" as unsigned character, as follows:
Additional query words:
Keywords : kbcode kbLangC kbVC kbVC100 kbVC150 kbVC151 kbVC152 kbVC200 kbVC210 kbVC400 kbVC500 kbVC600 |
Last Reviewed: July 1, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |