* Martin Sebor:
> At the same time, the following passes on x86_64:
>
> __attribute__ ((aligned (1))) void f1 (void) { }
> _Static_assert (__alignof__ (f1) == 1); // wrong alignof result
>
> __attribute__ ((aligned)) void f0 (void) { }
> _Static_assert (__alignof__ (f0) == 16);
>
> __attribute__ ((aligned (2))) void f2 (void) { }
> _Static_assert (__alignof__ (f2) == 2);
Is there any value in implementing alignof on functions?
sizeof (f1) is defined to be 1, allegedly to support function pointer
arithmetic (which is why sizeof (void) is 1 as well). In practice, this
is confusing to the programmer because the size of a function is at
least known to the linker.
Thanks,
Florian