2 !!DESCRIPTION!! pointer test
4 !!LICENCE!! public domain
11 check behaviour on incompletely declared arrays
21 if(sizeof(i1[0])==sizeof(char)) {
22 /* gcc gives size of element */
23 printf("sizeof(i1[0]) gives size of element\n");
25 if(sizeof(i1[0])==sizeof(char*)) {
26 printf("sizeof(i1[0]) gives size of pointer to element\n");
31 check behaviour on string init
44 c1=t1[i];c2=t2[i];c3=t3[i];c4=t4[i];
45 /* printf("%02x %02x %02x %02x\n",c1,c2,c3,c4); */
46 printf("%c %c %c %c\n",c1,c2,c3,c4);
47 if(!((c1==c2)&(c1==c3)&(c1==c4))) e=1;
49 if(e) printf("test2 failed.\n");
50 else printf("test2 ok.\n");
54 check behaviour on extern-declarations inside functions
62 #ifdef NO_SLOPPY_STRUCT_INIT
64 { "test3", (void*) NULL },
65 { "test3", (void*) NULL },
68 /*gcc warning: missing braces around initializer (near initialization for `a3[0]')
69 this type of struct-initialization seems to be kinda common */
71 "test3", (void*) NULL ,
72 "test3", (void*) NULL ,
76 void test3a(A3 *list, int number){
77 printf("%s %d\n",list->name,number);
80 static void test31(void)
87 /* this variation compiles and works with cc65, but gives an error with gcc :=P */
88 static void test32(void)
95 static void test30(void)
101 todo: add test on function pointers in the form of (*func)(arg) ...
102 cc65 seems to have problems here aswell ;/