This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: clarification of intent WRT shadowing C library
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Subject: Re: clarification of intent WRT shadowing C library
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- Date: 27 Oct 2000 16:17:08 +0200
- Cc: libstdc++ at sources dot redhat dot com, ncm at zembu dot com, jason at cygnus dot com
- Organization: CodeSourcery, LLC
- References: <Pine.SOL.3.91.1001027064206.13713A-100000@cse.cygnus.com>
Benjamin Kosnik <bkoz@redhat.com> writes:
| > | Where the first option (designated by // 1) is the preferred solution,
| > | as this explicitly makes the std::sin refer to the extern "C"
| > | function.
| >
| > Well, I see Jason's point but I'm not comfortble with it. We should
| > proceed in a way so that <cxxx> hearders don't dump C function names
| > in the global scope. That is why I'm favouring the _C_legacy namespace
| > solution. Yes, it is frustrating the library is not yet functionning
| > out of box. Let's try hard.
|
| Yes, this should be the preference. The small matter of implementation
| details are non-trivial, however, and have been worked on for quite some
| time.....
OK, I understand.
[...]
| Note that (just in cmath) I'm unable to use the extern "C" declarations
| for all the functions:
|
| #if 0
| extern "C" double pow(double __x, double __y);
|
| extern "C" double pow(double, int);
This can't work because extern "C" functions can't be overloaded.
| #endif
| using ::pow;
|
| I can see no other way around this than the using declaration...
|
| > acos(double __x) { return _C_legacy::acos(double); }
|
| (_C_legacy not a namespace in the implementation I was talking about....)
Sorry for the confusion...
-- Gaby