Some shadow fixes.
Steven King
sxking@uswest.net
Thu May 18 19:53:00 GMT 2000
On Thu, 18 May 2000, Nathan Myers wrote:
>
> I think I see. We need to put code in both headers, something like:
>
> #ifndef _CPP_ALREADY_EXPORTED_ABS
> # define _CPP_ALREADY_EXPORTED_ABS 1
> using std::abs;
> #endif
>
> Normal name lookup will take care of the overloading, then.
>
> Of course, that's
>
> #ifdef __USE_C9X
> ... // other C9X-isms
> # ifndef _CPP_ALREADY_EXPORTED_ABS
> # define _CPP_ALREADY_EXPORTED_ABS 1
> using std::abs;
> # endif
> #endif
>
> in math.h. Fortunately there's not much overloading
> between C headers.
Hmmm, in rereading 7.3.3, this may just be the result of a gcc bug. What
seems to be happening is, given
// stdlib.h
namespace std
{
int abs(int);
}
using std::abs; // this in effect seems to 'finalize' abs are visable in ::
// math.h
namespace std
{
double abs(double);
}
using std::abs; // this does not make abs(double) visable in ::
int
main ()
{
double d = abs (0.1234); // calls ::abs(int);
}
but clearly (I think) based on 7.3.3, this is wrong and the second using
std::abs should make ::abs(double) visable.
Okay, I can resubmit a corrected patch but it wont work correctly until gcc is
fixed, or should we go with a work-around that isnt conforming but works
correctly with the current gcc and fix it when gcc is fixed? (which would be
more or less what I originally submitted)
--
Steven King
sxking@uswest.net
More information about the Libstdc++
mailing list