"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.

-- Gaby

Reply via email to