resolution of references by the compiler/linker

R

Rahul

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!!!
 
I

Ian Collins

Rahul said:
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.
 
R

Rahul

Declaring a variable extern is what makes it a global.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,184
Messages
2,570,976
Members
47,533
Latest member
medikillz39

Latest Threads

Top