| Tom St Denis 2006-06-30, 7:56 am |
| Christian Christmann wrote:
> That's the point. I figured out that GCC is considering both 'e' as one
> and the same object. However, I don't know if this strictly corresponds
> to ANSI C-99.
I don't see why not. I mean from an implementation point of view
"extern int e" just means use the symbol defined globally somewhere
else. The fact that "somewhere else" is within the same object file
doesn't really matter.
It's similar in concept to a forward declaration, e.g.
int somefunc(int);
int myfunc(int x) { return somefunc(x); }
int somefunc(int x) { return x + 1; }
You could also write it as
int myfunc(int x) { extern int somefunc(int); return somefunc(x); }
int somefunc(int x) { return x + 1; }
"gcc -pedantic --std=c99 -O2 -Wall -W"
Doesn't raise a single diagnostic at that. :-)
Tom
|