C++ PATCH: PR 9924

Danny Smith dannysmith@clear.net.nz
Tue Mar 18 03:19:00 GMT 2003


----- Original Message -----
From: "Benjamin Kosnik"
>
> > Namespaces are a more recent feature than extern "C", and are not as
widely
> > supported.  But glibc is certainly aware of them:
> > [snip]
>
> Yep. These were put in for glibc 2.3 specifically to enable correct
C++
> "C" compatibility header behavior. I worked up a solution for this,
> based on the non-default --enable-cheaders=c codepath that QNX uses to
> solve this problem, but never fully untangled it (all these solutions
> start to fall down when non-C99 stuff starts to come into play, like
> later POSIX revs)
>
> I can try to dig out my notes on this if anyone is interested.
>

Yes please.  I am aware of this post:
http://gcc.gnu.org/ml/libstdc++/2002-08/msg00284.html
glibc-2.3, namespace std work part 1


Is there a part 2?
Should ginclude'd files like stddef.h and stdarg.h be made C++ namespace
aware?  This has been a stumbling block when building libstdc++, with
rewritten  mingw32 C headers and cheaders=c model.

I have used this:
+ // When defined, underlying "C" library puts certain types and
+ // fucntions into namespace std, instead of the global namespace.
+ #define _GLIBCPP_USE_NAMESPACES 1
+

This define is used as in your example to enable std namespace for C90
(not C99) in C runtime headers.  Do I understand correctly your comment
above that POSIX standard names are also meant to go into  std
namespace?

Danny

> -benjamin



More information about the Gcc-patches mailing list