------- Comment #3 from marc dot glisse at normalesup dot org  2009-01-30 20:38 
-------
Hello,

looking at the two last comments, I think we are speaking of slightly different
things, although they are related. I was asking for some const_cast of the
return value, in case the const version of wcschr (or other) we are forwarding
to (from the non-const overload) has the official C++ prototype. In any case,
it can't hurt and makes the code a bit cleaner with respect to the intended
behaviour. I was then planning to ask glibc to insert a macro in the
declaration:
extern MYMACRO void* memchr(const void*,int,size_t); where MYMACRO could be
defined as "const" by a C++ implementation, but apparently an even better fix
was adopted, cool :-)

The fix mentionned by Jakub is the right way to do things for a well-behaved
libc (solaris with __cplusplus>=199711L, or apparently a very recent glibc).
Hopefully the same thing will be done for the other headers (cstdlib or cmath
for instance), although the interaction with C99/C++0X may require 2 macros
instead of just one.

Bug 33935 asks that g++ ship a string.h that is equivalent to cstring when
__CORRECT_ISO_CPP_STRING_H_PROTO is not defined. Obviously it is not that easy
because standard headers including each other may end up including the
wrappers, but now that glibc and its multiply included headers are out of the
way it may be easier (or not). Too bad there is no easy way to distinguish libc
headers from other headers.

Anyway, I want to thank you both because you did not consider these issues
negligible. I'd love to help, I know how to fix most of the bugs I have filed
related to solaris headers, but I still haven't managed to get the legal
paperwork done (keep changing employers, and the FSF disclaimer is not a paper
they have ever signed before).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30928

Reply via email to