From 3602585233638261198
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,bb04047befc790b4
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-02-22 11:34:05 PST
Path: supernews.google.com!sn-xit-03!supernews.com!freenix!isdnet!grolier!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: Jack Klein <jackklein@spamcop.net>
Newsgroups: comp.std.c++
Subject: Re: empty parameter list and extern "C"
Date: Thu, 22 Feb 2001 19:32:10 GMT
Organization: AT&T Worldnet
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <h9f99tc98a3gp6q4a2e5n47imt44fr8b5k@4ax.com>
References: <3a91a017.213629713@news.nikoma.de>
X-Trace: mail2news.demon.co.uk 982870336 mail2news:18507 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)
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Date: Thu, 22 Feb 2001 07:20:56 GMT
Lines: 47
Xref: supernews.google.com comp.std.c++:3743

On Wed, 21 Feb 2001 19:51:25 GMT, MikeAlpha@NoSpam_csi.com (Martin
Aupperle) wrote in comp.std.c++:

> Hello,
> 
> I hope that I remember right that a function with the signature
> 
> 	void f();
> 
> and compiled under a C-compiler can be called with arbitrary
> arguments. 
> But when I declare 
> 
> 	extern "C" void f();
> 
> and compile under a C++ compiler, I cannot call f with arguments. 
> 
> Is it correct that an empty argument list means "no arguments" even if
> we compile against an implementation that allows it ( here, the
> implementation of f is likely to be in a C-Module that must make no
> assumptions about the arguments and therefore can be called with
> arbitrary ones) ?
> 
> Thanks - Martin

Yes, that is correct.  Defining anything with C linkage via extern "C"
does not make it C when compiled by a C++ compiler.  Only the linkage
is affected, and the standard does not actually provide a rigorous
definition of linkage, except to point out some limitations that this
imposes.

Understand that C++ does not guarantee interoperability with code
compiled by a C compiler, or even by the same compiler in its C mode,
if it has one.  The intent is to provide this capability if possible,
but all that extern "C" is guaranteed to do is provide C linkage. 

-- 
Jack Klein
Home: http://JK-Technology.Com

---
[ 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                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]



