473,322 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

how to use the keyword extern in c?

hi all ,
anyone could tell me the useage of the keyworkd "extern" in c? and
the difference between c & cplusplus?

in the C99Rationalv5.10.pdf it lists 4 cases. while the first
common cases will incur the vc compiler to complain.
Nov 14 '05 #1
16 1779
On 24 Aug 2004 19:15:30 -0700, fj***@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.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #2
Jack Klein <ja*******@spamcop.net> wrote in message news:<ti********************************@4ax.com>. ..
On 24 Aug 2004 19:15:30 -0700, fj***@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 void func(); | void func();

in a c file.
Nov 14 '05 #3
Jack Klein <ja*******@spamcop.net> wrote in message news:<ti********************************@4ax.com>. ..
On 24 Aug 2004 19:15:30 -0700, fj***@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.
Nov 14 '05 #4
In <18**************************@posting.google.com > fj***@163.net (ooze) writes:
what's the difference when the keyword "extern" appears and when it doest appear?
for instance,
Assuming all declarations have file scope:
+++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++
extern int var1; | int var1;
declaration, external linkage tentative external definition
_________________________________________________ ____________
extern int var1 = 0x0bad; | int var1 = 0x0bad;
external definition external definition
_________________________________________________ ____________
extern void func(); | void func();


declaration, external linkage declaration, external linkage

As you can see, the only context where extern makes any difference is
in object declarations that are not intended to be definitions. Otherwise
it can be omitted in file scope declarations, because it is the default.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #5
Da*****@cern.ch (Dan Pop) wrote in message news:<cg**********@sunnews.cern.ch>...
In <18**************************@posting.google.com > fj***@163.net (ooze) writes:
what's the difference when the keyword "extern" appears and when it doest appear?
for instance,


Assuming all declarations have file scope:
+++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++
extern int var1; | int var1;


declaration, external linkage tentative external definition
_________________________________________________ ____________
extern int var1 = 0x0bad; | int var1 = 0x0bad;


external definition external definition
_________________________________________________ ____________
extern void func(); | void func();


declaration, external linkage declaration, external linkage

As you can see, the only context where extern makes any difference is
in object declarations that are not intended to be definitions. Otherwise
it can be omitted in file scope declarations, because it is the default.

Dan


thanks, as you stated,
I remember in C the defintion of an object can ONLY occur ONLY ONCE.

but if I write extern int var1 = 0x0bad ; in one.c,
and write extern int var1 = 0xdead; in another.c
the vc c compiler will happy accept it.

since you think
_________________________________________________ ____________
extern int var1 = 0x0bad; | int var1 = 0x0bad;


external definition external definition


how to explain it?

thanks
Nov 14 '05 #6
On 25 Aug 2004 18:37:26 -0700, fj***@163.net (ooze) wrote in
comp.lang.c:
Da*****@cern.ch (Dan Pop) wrote in message news:<cg**********@sunnews.cern.ch>...
In <18**************************@posting.google.com > fj***@163.net (ooze) writes:
what's the difference when the keyword "extern" appears and when it doest appear?
for instance,


Assuming all declarations have file scope:
+++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++
extern int var1; | int var1;


declaration, external linkage tentative external definition
_________________________________________________ ____________
extern int var1 = 0x0bad; | int var1 = 0x0bad;


external definition external definition
_________________________________________________ ____________
extern void func(); | void func();


declaration, external linkage declaration, external linkage

As you can see, the only context where extern makes any difference is
in object declarations that are not intended to be definitions. Otherwise
it can be omitted in file scope declarations, because it is the default.

Dan


thanks, as you stated,
I remember in C the defintion of an object can ONLY occur ONLY ONCE.

but if I write extern int var1 = 0x0bad ; in one.c,
and write extern int var1 = 0xdead; in another.c
the vc c compiler will happy accept it.

since you think
_________________________________________________ ____________
extern int var1 = 0x0bad; | int var1 = 0x0bad;


external definition external definition


how to explain it?

thanks


There are a lot of technical details about different models of linking
that is used by the linkers of different implementations on different
platforms. Some of them will allow multiple definitions of an
external symbol, as long as no more than one of them has an
initializer.

The C standard requires that any object or function with external
linkage that is not actually referenced in the program must have
exactly 0 or 1 definitions somewhere in the program. Any object
or function with external linkage that is actually referenced in a
program must have exactly 1 definition, no more and no less.

A violation of this requirement causes undefined behavior, and
compilers are never required to diagnose undefined behavior.

Any compiler should be able to compile the two source files with two
external definitions of 'var1', both with initializers. The error
should come when the two object files are linked together to make the
program.

I don't know of any version of Microsoft's Visual C++, or any other C
compiler for that matter, that will not generate an error if those two
source files are put into a single program.

Here is what I got from Visual C++ 6.0:

--------------------Configuration: multi - Win32
Debug--------------------
Linking...
multi2.obj : error LNK2005: _var1 already defined in multi1.obj
multi___Win32_Debug/multi.exe : fatal error LNK1169: one or more
multiply defined symbols found
Error executing link.exe.

multi.exe - 2 error(s), 0 warning(s)

And here is what I got from the Visual C++ 2005 Express Edition Beta:

------ Build started: Project: multi, Configuration: Debug Win32
------
Compiling...
multi2.c
Linking...
multi1.obj : error LNK2005: _var1 already defined in multi2.obj
Debug/multi.exe : fatal error LNK1169: one or more multiply defined
symbols found
Build log was saved at "file://c:\Program Files\Microsoft Visual
Studio 8\projects\multi\multi\Debug\BuildLog.htm"
multi - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #7
Jack Klein <ja*******@spamcop.net> wrote in message news:<fh********************************@4ax.com>. ..
On 25 Aug 2004 18:37:26 -0700, fj***@163.net (ooze) wrote in
comp.lang.c:
Da*****@cern.ch (Dan Pop) wrote in message news:<cg**********@sunnews.cern.ch>...
In <18**************************@posting.google.com > fj***@163.net (ooze) writes:

>what's the difference when the keyword "extern" appears and when it doest appear?
>for instance,

Assuming all declarations have file scope:

>+++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++
> extern int var1; | int var1;

declaration, external linkage tentative external definition

>_________________________________________________ ____________
>extern int var1 = 0x0bad; | int var1 = 0x0bad;

external definition external definition

>_________________________________________________ ____________
>extern void func(); | void func();

declaration, external linkage declaration, external linkage

As you can see, the only context where extern makes any difference is
in object declarations that are not intended to be definitions. Otherwise
it can be omitted in file scope declarations, because it is the default.

Dan


thanks, as you stated,
I remember in C the defintion of an object can ONLY occur ONLY ONCE.

but if I write extern int var1 = 0x0bad ; in one.c,
and write extern int var1 = 0xdead; in another.c
the vc c compiler will happy accept it.

since you think
>_________________________________________________ ____________
>extern int var1 = 0x0bad; | int var1 = 0x0bad;

external definition external definition


how to explain it?

thanks


There are a lot of technical details about different models of linking
that is used by the linkers of different implementations on different
platforms. Some of them will allow multiple definitions of an
external symbol, as long as no more than one of them has an
initializer.

The C standard requires that any object or function with external
linkage that is not actually referenced in the program must have
exactly 0 or 1 definitions somewhere in the program. Any object
or function with external linkage that is actually referenced in a
program must have exactly 1 definition, no more and no less.

A violation of this requirement causes undefined behavior, and
compilers are never required to diagnose undefined behavior.

Any compiler should be able to compile the two source files with two
external definitions of 'var1', both with initializers. The error
should come when the two object files are linked together to make the
program.

I don't know of any version of Microsoft's Visual C++, or any other C
compiler for that matter, that will not generate an error if those two
source files are put into a single program.

Here is what I got from Visual C++ 6.0:

--------------------Configuration: multi - Win32
Debug--------------------
Linking...
multi2.obj : error LNK2005: _var1 already defined in multi1.obj
multi___Win32_Debug/multi.exe : fatal error LNK1169: one or more
multiply defined symbols found
Error executing link.exe.

multi.exe - 2 error(s), 0 warning(s)

And here is what I got from the Visual C++ 2005 Express Edition Beta:

------ Build started: Project: multi, Configuration: Debug Win32
------
Compiling...
multi2.c
Linking...
multi1.obj : error LNK2005: _var1 already defined in multi2.obj
Debug/multi.exe : fatal error LNK1169: one or more multiply defined
symbols found
Build log was saved at "file://c:\Program Files\Microsoft Visual
Studio 8\projects\multi\multi\Debug\BuildLog.htm"
multi - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========

what's the difference between
"tentative external definition" &

"external definition"?

vc will accept if one object defined twice with the above respectivly.
Nov 14 '05 #8
Jack Klein <ja*******@spamcop.net> wrote in message news:<fh********************************@4ax.com>. ..
On 25 Aug 2004 18:37:26 -0700, fj***@163.net (ooze) wrote in
comp.lang.c:
Da*****@cern.ch (Dan Pop) wrote in message news:<cg**********@sunnews.cern.ch>...
In <18**************************@posting.google.com > fj***@163.net (ooze) writes:

>what's the difference when the keyword "extern" appears and when it doest appear?
>for instance,

Assuming all declarations have file scope:

>+++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++
> extern int var1; | int var1;

declaration, external linkage tentative external definition

>_________________________________________________ ____________
>extern int var1 = 0x0bad; | int var1 = 0x0bad;

external definition external definition

>_________________________________________________ ____________
>extern void func(); | void func();

declaration, external linkage declaration, external linkage

As you can see, the only context where extern makes any difference is
in object declarations that are not intended to be definitions. Otherwise
it can be omitted in file scope declarations, because it is the default.

Dan


thanks, as you stated,
I remember in C the defintion of an object can ONLY occur ONLY ONCE.

but if I write extern int var1 = 0x0bad ; in one.c,
and write extern int var1 = 0xdead; in another.c
the vc c compiler will happy accept it.

since you think
>_________________________________________________ ____________
>extern int var1 = 0x0bad; | int var1 = 0x0bad;

external definition external definition


how to explain it?

thanks


There are a lot of technical details about different models of linking
that is used by the linkers of different implementations on different
platforms. Some of them will allow multiple definitions of an
external symbol, as long as no more than one of them has an
initializer.

The C standard requires that any object or function with external
linkage that is not actually referenced in the program must have
exactly 0 or 1 definitions somewhere in the program. Any object
or function with external linkage that is actually referenced in a
program must have exactly 1 definition, no more and no less.

A violation of this requirement causes undefined behavior, and
compilers are never required to diagnose undefined behavior.

Any compiler should be able to compile the two source files with two
external definitions of 'var1', both with initializers. The error
should come when the two object files are linked together to make the
program.

I don't know of any version of Microsoft's Visual C++, or any other C
compiler for that matter, that will not generate an error if those two
source files are put into a single program.

Here is what I got from Visual C++ 6.0:

--------------------Configuration: multi - Win32
Debug--------------------
Linking...
multi2.obj : error LNK2005: _var1 already defined in multi1.obj
multi___Win32_Debug/multi.exe : fatal error LNK1169: one or more
multiply defined symbols found
Error executing link.exe.

multi.exe - 2 error(s), 0 warning(s)

And here is what I got from the Visual C++ 2005 Express Edition Beta:

------ Build started: Project: multi, Configuration: Debug Win32
------
Compiling...
multi2.c
Linking...
multi1.obj : error LNK2005: _var1 already defined in multi2.obj
Debug/multi.exe : fatal error LNK1169: one or more multiply defined
symbols found
Build log was saved at "file://c:\Program Files\Microsoft Visual
Studio 8\projects\multi\multi\Debug\BuildLog.htm"
multi - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========

if int var1; defined in one.c, and extern int var1=23; defined in
another.c.
vc will accept it.
vc will also accept
1) int var1 in one.c and int var1 in another.c
2) int var1 in one.c and int var1 = 23 in another.c

it seems to me that in a program an object can have mutiple tentative
definitions, but only one external definition.
Nov 14 '05 #9
In <18**************************@posting.google.com > fj***@163.net (ooze) writes:
if int var1; defined in one.c, and extern int var1=23; defined in
another.c.
vc will accept it.
vc will also accept
1) int var1 in one.c and int var1 in another.c
2) int var1 in one.c and int var1 = 23 in another.c
Assuming all declarations have file scope, there are two external
definitions for var1 in all your examples.
it seems to me that in a program an object can have mutiple tentative
definitions, but only one external definition.


Only fools try to figure out how the language works from the behaviour of
their compilers. If multiple definitions of an object cause undefined
behaviour, any implementation is free to silently accept them. And,
according to Annex J.2 (I'm too lazy to search the chapter and verse):

- An identifier with external linkage is used, but in the program
there does not exist exactly one external definition for the
identifier, or the identifier is not used and there exist
multiple external definitions for the identifier (6.9).

So, VC is free to silently accept as many external definitions for var1
as you provide. But the behaviour of your program is undefined, if it
provides more than one.

A tentative definition becomes a genuine definition at the end of the
translation unit, if not superseded by another definition for the same
object. This is why it is called "tentative" definition. So, your
conclusion is valid only for one translation unit (C source file plus
whatever stuff is included via #include directives), not for a complete
program containing multiple definitions for the same object in multiple
translation units.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #10
Da*****@cern.ch (Dan Pop) wrote in message news:<cg**********@sunnews.cern.ch>...
In <18**************************@posting.google.com > fj***@163.net (ooze) writes:
if int var1; defined in one.c, and extern int var1=23; defined in
another.c.
vc will accept it.
vc will also accept
1) int var1 in one.c and int var1 in another.c
2) int var1 in one.c and int var1 = 23 in another.c


Assuming all declarations have file scope, there are two external
definitions for var1 in all your examples.
it seems to me that in a program an object can have mutiple tentative
definitions, but only one external definition.


Only fools try to figure out how the language works from the behaviour of
their compilers. If multiple definitions of an object cause undefined
behaviour, any implementation is free to silently accept them. And,
according to Annex J.2 (I'm too lazy to search the chapter and verse):

- An identifier with external linkage is used, but in the program
there does not exist exactly one external definition for the
identifier, or the identifier is not used and there exist
multiple external definitions for the identifier (6.9).

So, VC is free to silently accept as many external definitions for var1
as you provide. But the behaviour of your program is undefined, if it
provides more than one.

A tentative definition becomes a genuine definition at the end of the
translation unit, if not superseded by another definition for the same
object. This is why it is called "tentative" definition. So, your
conclusion is valid only for one translation unit (C source file plus
whatever stuff is included via #include directives), not for a complete
program containing multiple definitions for the same object in multiple
translation units.

Dan


I don't have a C Standard at hand, could you excerpt the usage of
extern keyword from the Standard? thanks.

till now, I don't know what's right usage of the keyword. I don't want
to write a program depending on a specific compiler. if I can write
codes according to C Standard, I think it would be easy to port to
other OS, compiler.
Nov 14 '05 #11
ooze wrote:
.... snip ...
till now, I don't know what's right usage of the keyword. I don't
want to write a program depending on a specific compiler. if I can
write codes according to C Standard, I think it would be easy to
port to other OS, compiler.


I suggest you follow this simple rule in each .c .h file pair:

1. Mark all file scope variables as static, unless:
1a. You want to access them from some other file, when you
don't mark them static, and you do list them in the
associated .h file as extern.
2. Mark all functions as static, unless:
2a. You want to call them from some other file, when you
don't mark them as static, and you do put their
prototypes in the .h file. No extern needed.

Note that this is for files whose storage is primarily associated
with the .c file. Think of the .h file as a means of exporting
things that you want other modules to know about and access.

Similarly, where you put #defines and the ilk is dependent on who
needs to know. By confining them to the .c file you make their
scope local.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #12
CBFalconer <cb********@yahoo.com> wrote in message news:<41***************@yahoo.com>...
ooze wrote:

... snip ...

till now, I don't know what's right usage of the keyword. I don't
want to write a program depending on a specific compiler. if I can
write codes according to C Standard, I think it would be easy to
port to other OS, compiler.


I suggest you follow this simple rule in each .c .h file pair:

1. Mark all file scope variables as static, unless:
1a. You want to access them from some other file, when you
don't mark them static, and you do list them in the
associated .h file as extern.
2. Mark all functions as static, unless:
2a. You want to call them from some other file, when you
don't mark them as static, and you do put their
prototypes in the .h file. No extern needed.

Note that this is for files whose storage is primarily associated
with the .c file. Think of the .h file as a means of exporting
things that you want other modules to know about and access.

Similarly, where you put #defines and the ilk is dependent on who
needs to know. By confining them to the .c file you make their
scope local.

your method is good only for writting code by yourself. you can not
tell whether the code written by others is right or wrong, so it is
good if I could have a copy of the C Standard which giving the rules
what is right, what is undefined, what's wrong.
Nov 14 '05 #13
In <18**************************@posting.google.com > fj***@163.net (ooze) writes:
your method is good only for writting code by yourself. you can not
tell whether the code written by others is right or wrong, so it is
good if I could have a copy of the C Standard which giving the rules
what is right, what is undefined, what's wrong.


Anything wrong with K&R2?

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #14
Da*****@cern.ch (Dan Pop) wrote in message news:<cg**********@sunnews.cern.ch>...
In <18**************************@posting.google.com > fj***@163.net (ooze) writes:
your method is good only for writting code by yourself. you can not
tell whether the code written by others is right or wrong, so it is
good if I could have a copy of the C Standard which giving the rules
what is right, what is undefined, what's wrong.


Anything wrong with K&R2?

Dan


I didn't say anything wrong about K&R. I was talking about how to
judge whether the code write by others is right or not, Sir.

Anyone can post the usage of extern from the C Standard, don't state
them yourself.
Nov 14 '05 #15
ooze wrote:
Da*****@cern.ch (Dan Pop) wrote
fj***@163.net (ooze) writes:
your method is good only for writting code by yourself. you can
not tell whether the code written by others is right or wrong,
so it is good if I could have a copy of the C Standard which
giving the rules what is right, what is undefined, what's wrong.


Anything wrong with K&R2?


I didn't say anything wrong about K&R. I was talking about how to
judge whether the code write by others is right or not, Sir.

Anyone can post the usage of extern from the C Standard, don't
state them yourself.


My, someone is touchy and bites the hand that feeds. The point of
K&R2 is that it will explain things much better than digging
through the standard. I believe you have been told how to get
various versions of the standard already, so go and do your own
investigating.

--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 14 '05 #16
In <18**************************@posting.google.com > fj***@163.net (ooze) writes:
Da*****@cern.ch (Dan Pop) wrote in message news:<cg**********@sunnews.cern.ch>...
In <18**************************@posting.google.com > fj***@163.net (ooze) writes:
>your method is good only for writting code by yourself. you can not
>tell whether the code written by others is right or wrong, so it is
>good if I could have a copy of the C Standard which giving the rules
>what is right, what is undefined, what's wrong.


Anything wrong with K&R2?

Dan


I didn't say anything wrong about K&R. I was talking about how to
judge whether the code write by others is right or not, Sir.


And what's wrong with using K&R2 for this purpose?

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Grumble | last post by:
Hello everyone, As far as I understand, the 'inline' keyword is a hint for the compiler to consider the function in question as a candidate for inlining, yes? What happens when a function with...
9
by: Bryan Parkoff | last post by:
I have noticed that C programmers put static keyword beside global variable and global functions in C source codes. I believe that it is not necessary and it is not the practice in C++. Static...
18
by: tweak | last post by:
What's the best way to use extern when using multiplefiles that is easiest to maintain? Is it best to declare: extern int a; in a header file and include the header file in all files except...
5
by: siliconwafer | last post by:
Hi all, I wanted to know that is use of extern keyword mandatory in case of global variables and functions used in other source files? i.e consider a following piece of code from MSDN explaining...
32
by: lcdgoncalves | last post by:
Hi everyone Is there a real need to use keyword static with functions, if we simply don't declare their prototypes in .h file? Many textbooks avoid to discuss this matter and/or discuss only...
0
by: SamLee | last post by:
Hi, how can I use extern keyword for example. EXEC SQL BEGIN DECLARE SECTION; extern int sal; EXEC SQL END DECLARE SECTION;
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.