One extern usage

R

Richard Heathfield

newsock said:
What's the implied meaning of using extern below?

extern int main(void)
{
...
}

It's identical to:

int main(void)
{
...
}

and I presume you already know what that means.
 
R

Rick

Doesn't extern imply that the function or variable or whatever that's
being extern'd is externally defined some place? Does writing extern
like this have any possible side effects? What if it was written against
some variable?

Richard said:
It's identical to:

int main(void)
{
...
}

and I presume you already know what that means.


Thanks

Rick
 
D

Dan Pop

In said:
Doesn't extern imply that the function or variable or whatever that's
being extern'd is externally defined some place? Does writing extern
like this have any possible side effects? What if it was written against
some variable?

On function declarations/definitions, extern is the default and
explicitly mentioning it makes no differences.

On object declarations, extern prevents the declaration from becoming
a tentative definition.

Dan
 

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
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top