This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: libstdc++/2767
- To: libstdc++ at gcc dot gnu dot org
- Subject: Re: libstdc++/2767
- From: Stephen M. Webb <stephen at bregmasoft dot com>
- Date: Tue, 8 May 2001 21:16:19 -0400
- Cc: Peter Schmid <schmid at snake dot iap dot physik dot tu-darmstadt dot de>
- Organization: Bregmasoft
- References: <Pine.LNX.4.21.0105090308140.5372-100000@snake.iap.physik.tu-darmstadt.de>
- Reply-To: stephen at bregmasoft dot com
On Tue, 08 May 2001, you wrote:
> |Regardless, the current implementation is incorrect, as this declaration doesn't exist:
> | extern "C" const char* strchr(const char*, int);
> | should be
> | extern "C" char* strchr(const char*, int);
>
> I am puzzled. Stroustrup says in his book "The C++ programming
> language" (special edition) on page 599:
>
> "Functions for manipulating C-style strings are found in <string.h>
> and <cstring>:
> ...
> const char* strchr(const char*, int);
> char* strchr(char*, int);"
>
> On the following page he mentions the "C standard library definition,
> not C++" of strchr:
>
> char* strchr(cont char*, int);
>
> This is the same as stated in the book "C, a refrence manual by
> Harbison and Steele.
>
> Therefore, I believe, the prototypes in the current libstdc++
> implementation for strchr are indeed correct.
>
> One has to cope with the different signatures for the C and the C++
> versions of the function strchr (among others).
The prototypes in the ISO C++ standard should be considered the correct ones.
--
Stephen M. Webb
Principal Consultant, Bregmasoft
stephen at bregmasoft dot com