From 5428284351985644509
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ea96cc047f6a22cc
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-08-09 15:49:01 PST
Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: comeau@panix.com (Greg Comeau)
Newsgroups: comp.std.c++
Subject: Re: extern "C" -- what is the intent?
Date: Thu,  9 Aug 2001 22:48:13 GMT
Organization: Comeau Computing; http://www.comeaucomputing.com
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <9kupho$fpp$1@panix3.panix.com>
References: <090820010209154805%BobbySchmidt@mac.com>
Reply-To: comeau@comeaucomputing.com
X-Trace: mail2news.demon.co.uk 997397299 mail2news:1006 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Lines: 46
Xref: archiver1.google.com comp.std.c++:6911

In article <090820010209154805%BobbySchmidt@mac.com>,
Bobby Schmidt  <BobbySchmidt@mac.com> wrote:
>In my Sep 2001 column for CUJ, I conjecture that the C++ standard's
>authors explicitly intend `extern "C"` to let C++ code call C code, but
>do not explicitly intend it to allow C code to call C++. The standard
>may tolerate C calling C++ -- and indeed, many C++ implementations
>allows such calls -- but the standard does not explicitly guarantee or
>even endorse this behavior.

IMO, it allows both directions, but guarantees neither direction.

>Scott Meyers has a different interpretation: `extern "C"` lets code be
>called as if it were written in C, regardless of what it's actually
>written in. Further, by Scott's reckoning, the standard intentionally
>allows such C++ code to be callable from C. (He enshrines this in Item
>34 of More Effective C++.)

I wouldn't use those words, but otherwise agree with the gist.

>To support his argument, Scott draws connections between subclauses 3.5
>and 7.5 that make me a bit nervous. Nonetheless, I'm now thinking that
>he's right and my CUJ item is wrong, or at least misleading/incomplete
>-- that `extern "C"` is an editorial on the code's apparent semantics,
>and not on the actual/intended language of the caller or callee.

Unless this says what you just said above, it might be best for
you to elaborate upon what you just said.

>So I'm appealing for wisdom here: what *exactly* is the Committee's
>intent for `extern "C"`? And what of that intent is guaranteed by the
>standard vs. simply tolerated?

I don't think anything is guaranteed here, but I do think a lot
of flexibility and intent is granted.
-- 
Greg Comeau                 Countdown to "export": December 1, 2001
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout

Tasty C99/C++ Combo: Dinkumware libs + Comeau Compilers == WOW!!!

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]



