Re: extern



Richard Bos wrote:
> "Netocrat" <netocrat@xxxxxxxxxxx> wrote:
> > On Mon, 25 Jul 2005 09:36:04 +0100, Flash Gordon wrote:
> > > Old Wolf wrote:
<snip>
>> 6.2.2p4 fully defines the meaning of the extern keyword, and that is as
>> an external linkage declarator. An exception is made that where a
>> variable was previously declared with the static keyword, a later
>> declaration with the extern keyword does not reverse the original
>> internal linkage of the object, but clearly the general case is that
>> extern == external linkage.
>
> No, it isn't. Declared extern usually implies external linkage, but not
> v.v. Most objects and functions with external linkage are not declared
> extern.

"==" was the wrong thing to write, and not what I intended. Instead
substitute "means".

> > >> So you are using "an extern" to mean "something declared with the
> > >> keyword 'extern'". I (and Mark McIntyre, apparently), use "an extern"
> > >> to mean "something with external linkage".
> >
> > Which is exactly what it seems to be defined to be.
>
> Which of the two? With external linkage, or _explicitly_ declared with
> external linkage? There's the whole point of this sub-thread, I think.

Right, again unclearly worded. I meant that "an extern" is defined as
"something with external linkage" (with the noted exception) but did
not intend to imply the reverse.

6.2.2 also specifies that for a function-scope variable declaration,
linkage is external regardless of whether the extern keyword is used or
ommitted (so long as static is not used).

.



Relevant Pages

  • Re: Tell me about makefiles
    ... and then the linker links the object files ... This is not related to your question, but isn't the above declaration ... The extern keyword in the declaration is ...
    (comp.lang.c)
  • Re: Pointer to extern char?
    ... How can there be a pointer to extern char? ... that the function has external linkage? ... static int a, *b, c; ... linkage when a declaration occurs at file scope, ...
    (comp.lang.c)
  • Re: Calling C++ from C
    ... I think you can mix and match C and C++ in the same project, the extern keyword is when you need to do external linkage and need a calling convention. ... the IDE will invoke compilers slightly differently depending on whether you have an *.c or *.cpp file extension on the source file. ...
    (microsoft.public.vsnet.general)
  • Re: extern
    ... The extern keyword usually gives you external ... % grep var a.c b.c ... Both have external linkage, but the "extern" in b.c inhibits ... "common block of size sizeof" will see the Fortran COMMON ...
    (comp.lang.c)
  • Re: Suggestions for declarations.
    ... Spiros Bousbouras wrote: ... Just declare them without using extern. ... but if I remove the early extern declaration and ... (uppercase 'D' is 'external linkage, ...
    (comp.lang.c)