From -7939501196474222277
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,3b852614b232b53b
X-Google-Attributes: gidf78e5,public
From: AllanW@my-dejanews.com
Subject: Re: function pointer types(was: Re: atexit() behavior)
Date: 1998/12/02
Message-ID: <744ak9$bpg$1@nnrp1.dejanews.com>#1/1
X-Deja-AN: 418022858
X-NNTP-Posting-Host: 199.125.171.8
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <365f3482.0@10.1.1.65> <73vc1v$5oe$1@nnrp1.dejanews.com> <fneilYAeA0Y2Ewh7@robinton.demon.co.uk> <3663B9D8.283B0424@physik.tu-muenchen.de> <741t78$a8v$1@nnrp1.dejanews.com> <74220p$3hl$1@engnews2.Eng.Sun.COM>
X-Snookums: I love you
X-UID: 0000000001
X-Status: $$$T
X-Http-User-Agent: Mozilla/4.06 [en] (Win95; U)
X-Http-Proxy: 1.0 x15.dejanews.com:80 (Squid/1.1.22) for client 199.125.171.8
Organization: Deja News - The Leader in Internet Discussion
X-Article-Creation-Date: Wed Dec 02 21:14:52 1998 GMT
Newsgroups: comp.std.c++
Originator: clamage@taumet


In article <74220p$3hl$1@engnews2.Eng.Sun.COM>,
  stephen.clamage@sun.com (Steve Clamage) wrote:
>
> AllanW@my-dejanews.com writes:
>
> >> Does that mean that I can do
> >>
> >> bool is_c_function(void(*)()) { return false; }
> >> extern "C"
> >> {
> >>   bool is_c_function(void(*)()) { return true; }
> >> }
>
> >This is equivalent to what the standard does, and (at least for
> >user-written code) it is illegal.
>
> No, it is legal. The parameters have the linkage of the
> function, and so are different types.
>
> >I think you want is
> >    bool is_c_function(extern "C"   void(*)()) { return true;  }
> >    bool is_c_function(extern "C++" void(*)()) { return false; }
> >The difference here is that we're using two different parameter
> >types, rather than two different return types.
>
> But language linkage can appear only at namespace scope. This
> code is both illegal and unnecessary.

Yes, I see that now; another post of yours pointed me to the correct
section of the standard.

But how would you declare two functions, both with C++ linkage,
both accepting one parameter, where the first function's parameter
is pointer-to-C-function and the second function's parameter is
pointer-to-C++-function?

--
AllanW@my-dejanews.com is a "Spam Magnet" -- never read.
Please reply in USENET only, sorry.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]




