This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


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

Re: libstdc++/2767


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


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