This preview shows page 1. Sign up to view the full content.
Unformatted text preview: \n", u, u); When run on a 32-bit machine it prints the following:
x = 4294967295 = -1 u = 2147483648 = -2147483648 In both cases, printf prints the word ﬁrst as if it represented an unsigned number and second as if it represented a signed number. We can see the conversion routines in action: Ì¾Í ¿¾ ´ ½µ ÍÅ Ü ¿¾ ¿½ ¿½ ¿¾ ¿½ ¾ ¾ and Í¾Ì ¿¾ ´¾ µ ¾ ¾ ¾ ÌÅ Ò ¿¾. Some peculiar behavior arises due to C’s handling of expressions containing combinations of signed and unsigned quantities. When an operation is performed where one operand is signed and the other is unsigned, C implicitly casts the signed argument to unsigned and performs the operations assuming the numbers are nonnegative. As we will see, this convention makes little difference for standard arithmetic operations, but it leads to nonintuitive results for relational operators such as < and >. Figure 2.13 shows some sample relational expressions and their resulting evaluations, as...
View Full Document