1 #include <stdio.h>
2
3 int
main()4 main() {
5 int i;
6 long l;
7 long long ll;
8
9 /* Make sure that << and >> do not convert */
10 if (sizeof(123 << 1L) != sizeof(int)) {
11 puts("bugged");
12 } else {
13 puts("ok");
14 }
15 if (sizeof(i << l) != sizeof(int)) {
16 puts("bugged");
17 } else {
18 puts("ok");
19 }
20
21
22 /* Another time for long long (on systems where int equ long) */
23 if (sizeof(123 << 1LL) != sizeof(int)) {
24 puts("bugged");
25 } else {
26 puts("ok");
27 }
28 if (sizeof(i << ll) != sizeof(int)) {
29 puts("bugged");
30 } else {
31 puts("ok");
32 }
33
34
35 /* Make sure that the shift target is promoted */
36 printf("%d, %d\n", (char)3 << 4, (char)64 >> 2);
37 printf("%d, %d\n", (int)sizeof((char)3 << 4), (int)sizeof((char)64 >> 2));
38
39 /* Make sure that comma operator yields neither promotion nor UAC */
40 printf("%d\n", (int)sizeof((char)0, (char)1));
41 return 0;
42 }
43
44