more [shadow] problems.

Nathan Myers
Fri May 26 17:39:00 GMT 2000

On Fri, May 26, 2000 at 10:46:55AM -0700, Steven King wrote:
> using the name.h form doesn't expose the non-standard names in the global
> namespace.  ie
> #include <math.h>
> int
> main ()
> {
>    // this doesnt work
>    __exception e;
>    matherr (&e);
>    // this does
>    _C_legacy::__exception e;
>    _C_legacy::matherr (&e);
> }

Feature, not bug.  In fact, design goal.

When you #include a standard header, it's not supposed to stomp 
all over the namespace and break your program.  The vendors have 
routinely ignored this, except Glibc.  (It's also not supposed to 
sub-include other standard headers -- at least C headers aren't.)

I might want to define my own "matherr()" function, and an ISO 
standard conforming <math.h> has no authority to break it.  In 
fact, Glibc does protect matherr with __USE_SVID, and our shadow 
header needs the same thing.  This is not to say the declarations
shouldn't be there; it just means we have more work to do.

That's why we were talking about adding declarations of extensions,
girded about with "#ifdef __USE_GROTTY_EXTENSION".

Nathan Myers
ncm at cantrip dot org

More information about the Libstdc++ mailing list