This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: Development status
- To: drepper at cygnus dot com
- Subject: Re: Development status
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Mon, 10 Apr 2000 01:25:35 +0200
- CC: libc-alpha at sourceware dot cygnus dot com, libstdc++ at sourceware dot cygnus dot com
- References: <m3u2hb4qum.fsf@localhost.localnet>
> If you're interested in the glibc 2.2 development and want to help you
> should make
>
> http://www.cygnus.com/~drepper/TODO.html
>
> your new home page. I've started to create the list to be finished
> before glibc 2.2.
I just noticed the item
# Somebody should work together with the C++ people to determine what
# can and should be done to help them implement the ISO C++
# library. This mainly includes support for the std:: namespace.
Besides std::, there is another issue: In C++, C library functions
must be implemented as functions, even though the C standard allows to
implement them as macros. Likewise, names documented as macros must be
implemented as such, even though the C standard allows to implement
them as functions (17.4.1.2/5; C++ lists assert, errno, offsetof,
setjmp, va_arg, va_end, and va_start as macros).
Maybe this requirement is already implemented, if so, the better. If
not, I'd volunteer to provide the necessary patches.
As for std::, C++ defines the <cfoo> headers as primary sources, and
<foo.h> as derived sources, which essentially have using-directives
for all functions. I see two options:
A) Put the real stuff of all STDC headers into <cfoo>, and add
'namespace std{' into __BEGIN_DECLS. Then, in foo.h, say
#include <cfoo>
#ifdef __cplusplus
using std::bar;
#endif
This would be the 'right' thing for C++, but is a big change for C.
B) Change the std headers so that they work for both <foo.h> and
<cfoo>. Add 'namespace std{' into __BEGIN_DECLS. At the end of each
header, add a block
#ifndef __cplusplus
#ifndef _CFOO
#define _CFOO
using std::bar;
#endif
This allows to write <cfoo> headers that look like that
#ifndef _CFOO
#define _CFOO
#include <foo.h>
#endif
Whether these <cfoo> headers would be shipped with glibc or not is
another matter. There is an interaction between the headers because
of the multiple-inclusion protection. GCC's libstdc++ v2 uses
__CFOO__ at the moment, libstdc++ v3 uses _CPP_CFOO. For gcc 2.95,
the added code is a no-op anyway (because std:: is ignored), so
there is no real compatibility problem.
Maybe there are other options as well; the decision would be Ulrich's
in the end.
Regards,
Martin