modernc.org/ccgo/v3@v3.16.14/lib/testdata/tcc-0.9.27/tests/tests2/93_integer_promotion.c (about) 1 /* integer promotion */ 2 3 int printf(const char*, ...); 4 #define promote(s) printf(" %ssigned : %s\n", (s) - 100 < 0 ? " " : "un", #s); 5 6 int main (void) 7 { 8 struct { 9 unsigned ub:3; 10 unsigned u:32; 11 unsigned long long ullb:35; 12 unsigned long long ull:64; 13 unsigned char c; 14 } s = { 1, 1, 1 }; 15 16 promote(s.ub); 17 promote(s.u); 18 promote(s.ullb); 19 promote(s.ull); 20 promote(s.c); 21 printf("\n"); 22 23 promote((1 ? s.ub : 1)); 24 promote((1 ? s.u : 1)); 25 promote((1 ? s.ullb : 1)); 26 promote((1 ? s.ull : 1)); 27 promote((1 ? s.c : 1)); 28 printf("\n"); 29 30 promote(s.ub << 1); 31 promote(s.u << 1); 32 promote(s.ullb << 1); 33 promote(s.ull << 1); 34 promote(s.c << 1); 35 printf("\n"); 36 37 promote(+s.ub); 38 promote(+s.u); 39 promote(+s.ullb); 40 promote(+s.ull); 41 promote(+s.c); 42 printf("\n"); 43 44 promote(-s.ub); 45 promote(-s.u); 46 promote(-s.ullb); 47 promote(-s.ull); 48 promote(-s.c); 49 printf("\n"); 50 51 promote(~s.ub); 52 promote(~s.u); 53 promote(~s.ullb); 54 promote(~s.ull); 55 promote(~s.c); 56 printf("\n"); 57 58 promote(!s.ub); 59 promote(!s.u); 60 promote(!s.ullb); 61 promote(!s.ull); 62 promote(!s.c); 63 printf("\n"); 64 65 promote(+(unsigned)s.ub); 66 promote(-(unsigned)s.ub); 67 promote(~(unsigned)s.ub); 68 promote(!(unsigned)s.ub); 69 70 return 0; 71 }