Re: how to use the keyword extern in c?
From: ooze (fjpan_at_163.net)
Date: 08/25/04
- Next message: Thomas Matthews: "Re: is there a better way to optimise this code"
- Previous message: ooze: "Re: how to use the keyword extern in c?"
- In reply to: Jack Klein: "Re: how to use the keyword extern in c?"
- Next in thread: Dan Pop: "Re: how to use the keyword extern in c?"
- Reply: Dan Pop: "Re: how to use the keyword extern in c?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Aug 2004 07:39:53 -0700
Jack Klein <jackklein@spamcop.net> wrote in message news:<ti1oi0pucb87tneidrgt50hacnbjlfk9rt@4ax.com>...
> On 24 Aug 2004 19:15:30 -0700, fjpan@163.net (ooze) wrote in
> comp.lang.c:
>
> > hi all ,
> > anyone could tell me the useage of the keyworkd "extern" in c?
>
> The extern keyword specifies that the identifier being declared has
> external linkage. This allows an object or function to be defined in
> one translation unit (basically, source file and everything it
> includes) and referred to by name from code in other translation
> units.
>
> > and
> > the difference between c & cplusplus?
>
> C++ is off-topic here, news:comp.lang.c++ is down the hall to the
> right.
>
> > in the C99Rationalv5.10.pdf it lists 4 cases. while the first
> > common cases will incur the vc compiler to complain.
>
> As to what Visual C++ might complain about, it might make a difference
> whether you are using it as a C or C++ compiler, as it handles both
> languages.
>
> The document you reference is not necessarily one that many people
> have.
>
> Even for those who do, like I do, your reference is far too vague.
> The document is well over 200 pages, and the word 'extern' appears
> many times. I spent a brief time looking in both the PDF and printed
> versions I have, and did not find the section you are referring to.
>
> Post again and include the specific section number from the document.
> That is, if you are indeed compiling C code and not C++. And for
> readers here who do not have a copy of the rationale, copy and paste
> the code sample you are referring to, and copy and paste the compiler
> or linker error messages as well.
hallo,
in section 6.2.2 Linkages of identifiers
there is a table listed the 4 cases also includes detail info.
what's the difference when the keyword "extern" appears and when it doest appear?
for instance,
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
extern int var1; | int var1;
_____________________________________________________________
extern int var1 = 0x0bad | int var1 = 0x0bad
_____________________________________________________________
extern void func(); | void func();
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
in a c file.
- Next message: Thomas Matthews: "Re: is there a better way to optimise this code"
- Previous message: ooze: "Re: how to use the keyword extern in c?"
- In reply to: Jack Klein: "Re: how to use the keyword extern in c?"
- Next in thread: Dan Pop: "Re: how to use the keyword extern in c?"
- Reply: Dan Pop: "Re: how to use the keyword extern in c?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|