What is extern "C" ?

V

Vijay Kumar Zanvar

Hello

I have seen in many source files the usage of extern +ACI-C+ACI-.
What is its purpose?

Thanks

VRZ
 
B

Ben Pfaff

Vijay Kumar Zanvar said:
I have seen in many source files the usage of extern "C".
What is its purpose?

That's a C++ construct, so you should ask about it in
comp.lang.c++, after checking their FAQ.
 
T

Tim Prince

Vijay said:
Hello

I have seen in many source files the usage
What is its purpose?
Should not appear in C code. Declares a symbol in C++ to have C compatible
linkage.
 
G

Glen Herrmannsfeldt

(snip)
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan

It seems that according to Brooks' law it is the same.

Brooks law goes something like: "Writing the code takes the first 90% of the
time, and debugging takes the second 90%."

(See the book "Mythical Man Month")

-- glen
 
C

Christian Bau

"Vijay Kumar Zanvar said:
Hello

I have seen in many source files the usage of extern "C".
What is its purpose?

It is part of the C++ language. It tells a C++ compiler that a function
is written in C. Don't use this in C programs, your C compiler will just
barf on you.
 
J

Jack Klein

It is part of the C++ language. It tells a C++ compiler that a function
is written in C. Don't use this in C programs, your C compiler will just
barf on you.

While C++ is off-topic here, your answer is incorrect. It tells a C++
compiler that a function has C linkage, not that it is written in C.

--
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++ ftp://snurse-l.org/pub/acllc-c++/faq
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,568
Members
47,204
Latest member
abhinav72673

Latest Threads

Top