🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1604

Re: Linkage revisited

#1604
From: Fergus Henderson
Date: Tue, 01 Aug 1995 12:36
53 lines
2585 bytes
>jason@cygnus.com (Jason Merrill) writes:
>--> Fergus Henderson <fjh@munta.cs.mu.OZ.AU> writes:
>-->
>-->> This is a serious incompatibility with C, since it makes it impossible
>-->> to pass the address of a static function to qsort().
>-->
>-->No, it doesn't.
>-->
>-->extern "C" {
>-->  static int qsort_callback (const void *, const void *) { ... }
>-->}

I haven't seen Jason Merill's post yet, except as quoted above.
But the ARM and the draft working paper *clearly* state that the
linkage-specification in the above example has no effect. 

|   7.5  Linkage specifications                                 [dcl.link]
| 
| 5 Linkage can be specified for objects.  [Example:
|           extern "C" {
|               // ...
|               _iobuf _iob[_NFILE];
|               // ...
|               int _flsbuf(unsigned,_iobuf*);
|               // ...
|           }
|    --end example] Functions and objects can be declared static or inline
|   within  the  {}  of a linkage specification.  THE LINKAGE DIRECTIVE IS
|   IGNORED FOR A FUNCTION OR OBJECT WITH INTERNAL LINKAGE (_basic.link_).
|   A  function  first  declared  in  a linkage specification behaves as a
|   function with external linkage.  [Example:
|           extern "C" double f();
|           static double f();     // error
|   is ill-formed (_dcl.stc_).  ] An object defined within an
|           extern "C" { /* ... */ }
|   construct is still defined (and not just declared).

pardoej@lonnds.ml.com (Julian Pardoe LADS LDN X1428) writes:

>Anyway, enough quibbling.  Do I understand from this discussion that
>
>** (A) ** In ANSI C++ there will be no way to declare a pointer to a function
>with non-C++ linkage.

I for one would not like to predict the future.
I think the only think one can say for certain is that
the answer to your question is as yet uncertain.

-- 
Fergus Henderson              | Designing grand concepts is fun;
fjh@cs.mu.oz.au               | finding nitty little bugs is just work.
http://www.cs.mu.oz.au/~fjh   | -- Brooks, in "The Mythical Man-Month".
PGP key fingerprint: 00 D7 A2 27 65 09 B6 AC  8B 3E 0F 01 E7 5D C4 3F
Technical Details
Message-ID: <9521322.13300@mulga.cs.mu.OZ.AU>
Path: arc1-ca.pugleaf.net!munta.cs.mu.OZ.AU!fjh
References: <u9ivorlolb.fsf@phydeaux.cygnus.com> <DCFBL2.HzD@tigadmin.ml.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: Linkage revisited
Message-ID: <9521322.13300@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU (CS-Usenet)
Organization: Computer Science, University of Melbourne, Australia
References: <u9ivorlolb.fsf@phydeaux.cygnus.com> <DCFBL2.HzD@tigadmin.ml.com>
Date: Tue, 1 Aug 1995 12:36:42 GMT