The feature I'm proposing is not supported by the C standard, so I'm proposing a gcc extension.
I am wondering if it's possible to make the difference of two function pointer be a constant value if the two functions are defined as static and in the same file. That would allow for function pointer tables that live in .rodata instead of .data. Something like: #include <stdio.h> typedef int (*func_t) (void); static int func_base (void) { return 0; } static int func0 (void) { return 0; } static int func1 (void) { return 1; } size_t funcs[] = { func0 - func_base, func1 - func_base }; int main (void) { int i; for (i = 0; i < 2; i++) printf ("%d: %d\n", i, ((func_t)(funcs[i] + func_base))()); } -- Summary: Support pointer difference as constant in static initializer Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gnu at behdad dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38295