This is the mail archive of the libstdc++@sources.redhat.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: clarification of intent WRT shadowing C library


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]