conversion test

This commit is contained in:
bellard 2006-10-28 14:47:14 +00:00
parent 365d0ad545
commit 65b974e396

View File

@ -1073,6 +1073,8 @@ void cast_test()
int a;
char c;
char tab[10];
unsigned b,d;
short s;
printf("cast_test:\n");
a = 0xfffff;
@ -1095,7 +1097,15 @@ void cast_test()
printf("%d\n", a);
printf("sizeof(c) = %d, sizeof((int)c) = %d\n", sizeof(c), sizeof((int)c));
/* test cast from unsigned to signed short to int */
b = 0xf000;
d = (short)b;
printf("((unsigned)(short)0x%08x) = 0x%08x\n", b, d);
b = 0xf0f0;
d = (char)b;
printf("((unsigned)(char)0x%08x) = 0x%08x\n", b, d);
/* test implicit int casting for array accesses */
c = 0;
tab[1] = 2;