]> pd.if.org Git - lice/blob - tests/void.c
autocommit for files dated 2014-11-17 20:15:14
[lice] / tests / void.c
1 // arithmetic on void
2
3 int main(void) {
4     expecti(sizeof(void), 1);
5     expecti(sizeof(main), 8); // sizeof function == sizeof(&function)
6                               // i.e the function pointer for that
7                               // function (GCC extension)
8
9     int a[] = { 1, 2, 3 };
10     void *p = (void*)a;
11
12     expecti(*(int*)p, 1); p += 4;
13     expecti(*(int*)p, 2); p += 4;
14     expecti(*(int*)p, 3);
15
16     return 0;
17 }