X-Git-Url: https://pd.if.org/git/?p=lice;a=blobdiff_plain;f=tests%2Fvoid.c;fp=tests%2Fvoid.c;h=20adc93f74c418b78070b35904cdaadfb1440040;hp=0000000000000000000000000000000000000000;hb=b6a50b8be3d6a2e2d6624983f6bf1bf0c9f6802a;hpb=946bdbe1d5dd89ab671391fbe429a1c2c48ecaa7 diff --git a/tests/void.c b/tests/void.c new file mode 100644 index 0000000..20adc93 --- /dev/null +++ b/tests/void.c @@ -0,0 +1,17 @@ +// arithmetic on void + +int main(void) { + expecti(sizeof(void), 1); + expecti(sizeof(main), 8); // sizeof function == sizeof(&function) + // i.e the function pointer for that + // function (GCC extension) + + int a[] = { 1, 2, 3 }; + void *p = (void*)a; + + expecti(*(int*)p, 1); p += 4; + expecti(*(int*)p, 2); p += 4; + expecti(*(int*)p, 3); + + return 0; +}