[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: help needed with gcc-4.4 build failure



On Wed, Feb 18, 2009 at 8:39 AM, Julian Sikorski <belegdol gmail com> wrote:
> man strchr says:
> char *strchr(const char *s, int c);
>
> I don't see what is wrong since the argument is a const char* string.
>
> I can't reproduce the issue. May be the signature of strchr changed in
> glibc?
> Anyway, the above signature is not consistent since it returns a char* which
> is a substring of a const char*.
> If this is the case, there is a need for a test in configure to find which
> signature version is available.
>
The manpages are out of date -- see Ulrich Drepper's post:
http://markmail.org/message/e5y6atneqztuvpw6#query:+page:1+mid:hdkehz7bgl5b6vgc+state:results

Called from C++, you have to do the following:
- include <cstring> rather than <string.h>
- if you pass in a const char *, the output should be stored in a
const char * variable
- otherwise, the output should be assigned to a char * variable

HTH,

-- 
miʃel salim  •  http://hircus.jaiku.com/
IUCS         •  msalim cs indiana edu
Fedora       •  salimma fedoraproject org
MacPorts     •  hircus macports org


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]