This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/2633] New: _GLIBCPP_USE_NAMESPACES issues


Hello,
I tried to define the _GLIBCPP_USE_NAMESPACES macro for c++ and hit several
problems. Here are some of them (I should have taken notes...).

In stdio.h, there is "typedef struct _IO_FILE FILE;" in namespace std, but
struct _IO_FILE has not been declared yet so the compiler assumes it is in
namespace std and later refuses to convert stdout to a std::FILE*. It would be
sufficient to declare _IO_FILE (in the global namespace) before this typedef.

pthread.h declares __jmp_buf_tag in the global namespace but setjmp.h declares
it in namespace std. This means the declarations for __sigsetjmp that follow
don't match.

locale.h: I believe __BEGIN_NAMESPACE_STD could be moved before the definition
of struct lconv.

In wchar.h, I can read there is a workaround for gcc stddef.h that puts wint_t
in the global namespace, but if I modify stddef.h to put wint_t in namespace std
and define _WINT_T, the functions declared in namespace __c99 or in the global
namespace have trouble with wint_t not being visible.

wchar.h: the declaration of struct tm looks like this:
__BEGIN_NAMESPACE_STD
struct tm;
__USING_NAMESPACE_STD(tm)
__END_NAMESPACE_STD
My guess is that the last 2 lines are in the wrong order.
Functions like wcscpy, wcscat or wcscmp should be in namespace std, not __c99.

I almost started my tests by replacing __c99 by std in sys/cdefs.h to remove
some errors. I was surprised to see __c99 was not made a subnamespace of std
(and there is no using namespace std in __c99), but I guess there are reasons.

-- 
           Summary: _GLIBCPP_USE_NAMESPACES issues
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: minor
          Priority: P3
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: marc dot glisse at normalesup dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=2633

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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