| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Rahul" |
| Date: |
05 Jan 2008 04:18:55 AM |
| Object: |
resolution of references by the compiler/linker |
Hi Everyone,
I was wondering if references to a function defined in another file
is resolved at linker time, why isn't the same extended for global
variables? I mean, without the extern keyword being used... does the
standard say that reference to global variables have to be resolved at
compile time?
Thanks in advance!!!
.
|
|
| User: "Ian Collins" |
|
| Title: Re: resolution of references by the compiler/linker |
05 Jan 2008 04:20:45 AM |
|
|
Rahul wrote:
Hi Everyone,
I was wondering if references to a function defined in another file
is resolved at linker time, why isn't the same extended for global
variables? I mean, without the extern keyword being used... does the
standard say that reference to global variables have to be resolved at
compile time?
Declaring a variable extern is what makes it a global.
--
Ian Collins.
.
|
|
|
| User: "Rahul" |
|
| Title: Re: resolution of references by the compiler/linker |
05 Jan 2008 04:37:31 AM |
|
|
On Jan 5, 3:20 pm, Ian Collins <ian-n...@hotmail.com> wrote:
Rahul wrote:
Hi Everyone,
I was wondering if references to a function defined in another file
is resolved at linker time, why isn't the same extended for global
variables? I mean, without the extern keyword being used... does the
standard say that reference to global variables have to be resolved at
compile time?
Declaring a variable extern is what makes it a global.
--
Ian Collins.
Sorry wanted to post in comp.lang.c where compiler assumes that a
undeclared function would return an int and would be defined in some
other compilation unit... c++ makes sure that a prototype is very much
necessary for a function call...
.
|
|
|
|
|

|
Related Articles |
|
|