Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > what dose it mean?

Reply
Thread Tools

what dose it mean?

 
 
snnn
Guest
Posts: n/a
 
      01-22-2005
///////////////////////
#ifdef __cplusplus
extern "C" {
#endif
////////////////////////
I often find it at c/c++ head files.


 
Reply With Quote
 
 
 
 
Efrat Regev
Guest
Posts: n/a
 
      01-22-2005
1. This has to do "name mangling" explained below, and
2. It is used for "connecting" C and C++ code, so that your project can
include both.

Suppose you write a method named "foobar". When your compiler turns your
code into an executable, it doesn't have to retain the *name* foobar; it can
change it let's say into "shmilky", as long everyone else knows that
"shmilky" really means the method you called "foobar". As a *user* of the
compiler, you usually shouldn't have to care about this.

Why would your compiler do that in the first place? probably not much of
an issue if you're not writing a compiler (check name mangling in Google, if
you're interested).
Why the extern "C", then? C and C++ are different languages, and would
understand "shmilky" differently. The extern "C" causes both of them to
understand that "shmilky" stands for "foobar" (which is what you want).

"snnn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> ///////////////////////
> #ifdef __cplusplus
> extern "C" {
> #endif
> ////////////////////////
> I often find it at c/c++ head files.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dose Anyone Here Have Olympus C-8080 david kelly Digital Photography 0 08-25-2004 07:25 PM
Dose anybody use Yproxy TINY Computer Information 0 08-12-2004 11:07 AM
Thread.sleep dose not work from the first time???? al ASP .Net 3 08-03-2004 02:41 PM
Dose anyone know about JAWS? kent Java 1 04-01-2004 07:24 PM
Nero Burner, what dose "Could not perform Fixation" erod mean? ppvll Computer Support 3 11-09-2003 09:31 PM



Advertisments