resolution of references by the compiler/linker



 DEVELOP > c-Plus-Plus > resolution of references by the compiler/linker

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

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



  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER