why the difference of two global pointers is not a constant?
Gabriel Dos Reis
gdr@integrable-solutions.net
Tue Jul 25 01:57:00 GMT 2006
"Rafael Espíndola" <rafael.espindola@gmail.com> 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
More information about the Gcc
mailing list