>> Thanks for the patch - it is actually more correct to have * as const
>> since table_name is const char*. However, SunPro CC is wrong in returning
>> const char* from strchr() - it is a bug. The following legitimate code
>> not work without forcing type casts, for example:
>> char *p;
>> ...// initialize p
>> p = strchr(p, '.');
>> *p = 0;
>> One may want to tinker with the contents of the location that strchr()
>> returned, so it should not be const. I guess their idea for making it
>> char* was that if you pass const char*, and return non-const this can
>> const correctness without a type cast.
>Hm. I may be completely wrong, but what if they have defined two
>versions of strchr(), one being const, the other one not. AFAIK, the
>compiler then chooses the const version before the non-const whenenver
>it can. This would make your example work nevertheless, Sasha.
>I haven't used this with global functions yet, but it works fine for
>member functions. One could check if they have done this by casting
>dot to char * before passing it to strchr().
This would be possible if strchr() was a pure C++ function. However, in
strict C function overloading is not allowed, so they would have to
distinguish with an #ifdef __cplusplus in the header file. Of course, a grep
though the header files for strchr will resolve all doubts.
MySQL Development Team
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sasha Pachev <sasha@stripped>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, http://www.mysql.com/
/_/ /_/\_, /___/\___\_\___/ Provo, Utah, USA