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