Home > Archive > C > June 2006 > Re: Scope of specifier extern
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: Scope of specifier extern
|
|
| Tom St Denis 2006-06-30, 7:56 am |
|
Christian Christmann wrote:
> Hi,
>
> I've a a question on the specifier extern.
>
> Code example:
>
> void func( void )
> {
> extern int e;
> //...
> }
>
> int e = 2;
>
> int main() void
> {
> func();
> return 0;
> }
Yes they're the same [at least with GCC on most platforms I can think
of]. "e" will be accessed globally and "int e = 2" exports the symbol
"e".
Now, had you wrote "static int e = 2" they would be different and most
likely platform dependent.
Tom
| |
| Christian Christmann 2006-06-30, 7:56 am |
| On Fri, 30 Jun 2006 04:55:43 -0700, Tom St Denis wrote:
>
> Yes they're the same [at least with GCC on most platforms I can think
> of].
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.
|
|
|
|
|