12 return r;
13 }
14
15 int main()
16 {
17 printf("-1 < 0U : %s\n", (-1 < 0U) ? "true" : "false");
18 printf("2147483647U > -2147483647 - 1 : %s\n", ( 2147483647U > -2147483647 - 1) ? "true" : "false");
19 printf("2147483647 > (int)2147483648U : %s\n", ( 2147483647 > (int)2147483648U) ? "true" : "false");
20
21 unsigned w = 0xFFFF;
22 printf("(int) ((w << 24) >> 24) = %x\n", (int) ((w << 24) >> 24));
23 printf("((int)(w << 24)) >> 24 = %x\n", ((int)(w << 24)) >> 24);
24
25 float a[1];
26 printf("sum %f\n", sum(a, 0));
27 return 0;
28 }
运行结果:
1 hcy@hcy-desktop:~$ ./a.out
2 -1 < 0U : false
3 2147483647U > -2147483647 - 1 : false
4 2147483647 > (int)2147483648U : true
5 (int) ((w << 24) >> 24) = ff
6 ((int)(w << 24)) >> 24 = ffffffff
7 段错误