From 2485487839910149683
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,3b852614b232b53b
X-Google-Attributes: gidf78e5,public
From: James Kuyper <kuyper@wizard.net>
Subject: Re: function pointer types(was: Re: atexit() behavior)
Date: 1998/12/01
Message-ID: <366402C8.167E@wizard.net>#1/1
X-Deja-AN: 417531028
X-NNTP-Posting-Host: gscsgi02.gsfc.nasa.gov
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>
Content-Type: text/plain; charset=us-ascii
Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA
Mime-Version: 1.0
Newsgroups: comp.std.c++
Originator: clamage@taumet


Christopher Eltschka 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.

> Does that mean that I can do

> bool is_c_function(void(*)()) { return false; }
> extern "C"
> {
>   bool is_c_function(void(*)()) { return true; }
> }

> and use that to differentiate between C and C++ functions?

No. The atexit() functions take an argument which can be either "C" or
"C++", and you can overload on argument types. Both of your functions
have the same argument type. How would the compiler know which one to
call?


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




