libstdc++/2767
Stephen M. Webb
stephen@bregmasoft.com
Tue May 8 18:49:00 GMT 2001
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
More information about the Libstdc++
mailing list