J
Josh Lessard
Hi all. I've read through all the K&R2 chapters (thanks for suggesting
it...it was a great read) and I'm now reading the appendices.
Specifically, I'm reading section A11 - Scope & Linkage p227. I have a
question about the "extern" specifier.
Section A11.2 Linkage p228 says:
"All declarations for the same object or function identifier with external
linkage refer to the same thing, and the object or function is shared by
the entire program."
and
"... the first external declaration for an identifier gives the identifier
internal linkage if the static specifier is used, external linkage
otherwise."
My questions are, is there any point to declaration an external object
"extern"? Does it have any effect(s)? I'm almost positive I've seen code
with external declarations that included the keyword "extern", but given
the quoted statements above, that seems redundant. Am I missing
something?
*****************************************************
Josh Lessard
Master's Student
School of Computer Science
Faculty of Mathematics
University of Waterloo
(519)888-4567 x3400
http://www.cs.uwaterloo.ca
*****************************************************
it...it was a great read) and I'm now reading the appendices.
Specifically, I'm reading section A11 - Scope & Linkage p227. I have a
question about the "extern" specifier.
Section A11.2 Linkage p228 says:
"All declarations for the same object or function identifier with external
linkage refer to the same thing, and the object or function is shared by
the entire program."
and
"... the first external declaration for an identifier gives the identifier
internal linkage if the static specifier is used, external linkage
otherwise."
My questions are, is there any point to declaration an external object
"extern"? Does it have any effect(s)? I'm almost positive I've seen code
with external declarations that included the keyword "extern", but given
the quoted statements above, that seems redundant. Am I missing
something?
*****************************************************
Josh Lessard
Master's Student
School of Computer Science
Faculty of Mathematics
University of Waterloo
(519)888-4567 x3400
http://www.cs.uwaterloo.ca
*****************************************************