This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Sample conformant, clean <c...> headers
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Subject: Re: Sample conformant, clean <c...> headers
- From: scott snyder <snyder at fnal dot gov>
- Date: 04 Jun 2001 19:24:53 -0500
- Cc: libstdc++ at gcc dot gnu dot org, "Stephen M. Webb" <stephen at bregmasoft dot com>
- References: <Pine.SOL.3.91.1010604154635.8146B-100000@taarna.cygnus.com>
hi -
Benjamin Kosnik <bkoz@redhat.com> writes:
> I would like feedback on Stephen's approach. I think it's sound, but am
> interested in hearing from Nathan and others.
>
> Nathan? Care to comment? Scott?
The problem i see is that the following test doesn't seem to work
(with the 20010529 version of gcc 3.0):
-------------------------------------
#include <cctype>
#include <ctype.h>
using namespace std;
int
main(int argc, char* argv[])
{
//using std::isalpha;
int k = 1;
if (isalpha('k'))
{
k = 0;
}
return k;
}
-------------------------------------
(This is Stephen's test program, but with `using namespace std' instead
of the `using std::isalpha'.)
If i try to compile this with Stephen's std_cctype.h header (creating
a local `cctype' that includes it), i get:
$ g++ -c -I. ./test_cctype.cc
test_cctype.cc: In function `int main(int, char**)':
test_cctype.cc:12: call of overloaded `isalpha(char)' is ambiguous
/usr/include/ctype.h:92: candidates are: int isalpha(int)
std_cctype.h:60: int std::isalpha(int)
I think this comes back to the requirement that for names from the
C headers, ::foo and std::foo are supposed to be the _same_ function.
As far as i can tell, the example above is allowed by the standard,
and should compile. Having that not work is likely to break lots
of real-world code.
Am i missing something here?
thanks,
sss