From -1690121821313726194
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/03
Message-ID: <746qnq$g51$1@nnrp1.dejanews.com>#1/1
X-Deja-AN: 418368406
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> <366656F7.6AD69015@physik.tu-muenchen.de>
X-Snookums: I love you
X-UID: 0000000002
X-Status: $$$T
X-Http-User-Agent: Mozilla/4.06 [en] (Win95; U)
X-Http-Proxy: 1.0 x9.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: Thu Dec 03 20:02:04 1998 GMT
Newsgroups: comp.std.c++
Originator: clamage@taumet


In article <366656F7.6AD69015@physik.tu-muenchen.de>,
  Christopher Eltschka <celtschk@physik.tu-muenchen.de> wrote:
 >
 >AllanW@my-dejanews.com wrote:
 > >
 > > In article <3663B9D8.283B0424@physik.tu-muenchen.de>,
 > >   Christopher Eltschka <celtschk@physik.tu-muenchen.de> wrote:
 > > > 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.
 > >
 > > > and use that to differentiate between C and C++ functions?
 > >
 > > 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 since my second function is declared in an extern "C" block,
 >AFAIK the parameter should be a pointer to C function.
 >BTW, I don't think you may use extern "C" inside the parameter list.

You're right. Your version should work, and mine is illegal.
Steve Clamage explained why in another post. Sorry if I misled you.

--
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              ]




