I guess you're right. I actually write C++, where extern is necessary to do
more or less what ENTRY does in assembler, and no, I can't cite chapter and
verse but I just commented out an extern keyword on a definition and the
link failed "unresolved."

Obviously in any language you need a definition somewhere. Otherwise
everyone is just declaring "this exists somewhere else." It has to actually
exist somewhere.

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Webster, Chris
Sent: Tuesday, August 18, 2015 5:01 PM
To: [email protected]
Subject: C extern was RE: Resolving EXTRN References

There is still supposed to be a definition in C that does NOT have extern
specified.  It is quite common to just use extern declarations and most
compilers account for this.

Quoting IBM:
An extern declaration makes the described variable usable by the succeeding
part of the current source file. This declaration does not replace the
definition. The declaration is used to describe the variable that is
externally defined.

IOW, the definition is the one true instance.  It should be the only one
with an initializer or things get confusing.  

...chris.
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Charles Mills
Sent: Tuesday, August 18, 2015 4:05 PM
To: [email protected]
Subject: Re: Resolving EXTRN References

Different from C, where you use extern on both ends.

Charles

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to