Gabriel Dos Reis writes:
> "Rafael Espíndola" <[EMAIL PROTECTED]> writes:
>
> | I am trying to build a table with offsets of global pointers from a
> | given pointer:
> |
> | void *fs[] = {f1 - f1, f2 - f1};
> |
> | where f1 and f2 are functions.
> |
> | GCC is able to figure out that (f1 - f1) is 0, but says "initializer
> | element is not constant" when trying to compute (f2 - f1).
>
> because that is what the language standard says.
>
> In general, the difference between two global pointers is something
> known only to the linker -- too late to evaluate as constant
> expression.
And in any case it's not legal C: see Section 6.5.6 para 9.
Andrew.