From 7403164704095559698
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,3b852614b232b53b
X-Google-Attributes: gidf78e5,public
From: Christopher Eltschka <celtschk@physik.tu-muenchen.de>
Subject: Re: function pointer types(was: Re: atexit() behavior)
Date: 1998/12/03
Message-ID: <366656F7.6AD69015@physik.tu-muenchen.de>#1/1
X-Deja-AN: 418270210
X-Nntp-Posting-Host: coulomb.t30.physik.tu-muenchen.de
Content-Transfer-Encoding: 7bit
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>
Content-Type: text/plain; charset=us-ascii
Organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany)
Mime-Version: 1.0
Newsgroups: comp.std.c++
Originator: clamage@taumet


AllanW@my-dejanews.com wrote:
 > 
 > In article <3663B9D8.283B0424@physik.tu-muenchen.de>,
 >   Christopher Eltschka <celtschk@physik.tu-muenchen.de> wrote:
 > >
 > > Francis Glassborow wrote:
 > >
 > > [...]
 > >
 > > > I think they have different signatures because the parameters are:
 > > >
 > > > pointer to extern "C" function
 > > > and
 > > > pointer to extern "C++" function
 > > >
 > > > and these types are differentiable.
 > 
 > Makes sense, but not so. The parameters are identical.
 > 
 > > 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.


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




