compiling app with unsigned char breaks wx/mimetype.h in 2.8.0rc1

Alicia da Conceicao alicia454 at gmail.com
Sat Nov 25 01:26:36 PST 2006


>  I've moved the code of this function in the .cpp file (as I assume you
> compile wx itself with signed char) which should also fix or, rather, hide
> your problem.

Hi VZ:

Yup, moving the code into the cpp file for the library should do the
trick and not cause any problems for user apps compiled with the
unsigned-char compiler option.  (I hope!)

I would be happy to test any patches you have before the next
release.

>  Yes, but it's not a correct fix just because it did. Frankly, would you be
> proud of having this horror
>> +        return m_verbs[n] + ((wxChar) wxT('=')) + m_commands[n];
> in your code? I know I don't want to have it in ours.
>  To repeat what I already said many times, the real fix is to define
> operator+() correctly. This would also allow you to build wx itself with
> unsigned char which would be a good idea as nothing says that you can mix
> the code built with signed and unsigned char as you currently do.

Actually the horror you mentioned is just a simple type casting, which
does not bother me as much as it bothers you.

Unfortunately, I don't see how fixing/modifying the overloaded "+" operator
would fix the error.  That seems to be focusing on the symptom, not the
cause.  Specifically, the expression:

     wxT('=')

which is defined as:

     _T('=')

is not converting into a wxChar when using the unsigned-char compiler
option, which is why the forced casting to wxChar works.  Any idea why
this is broken?

Alicia.




More information about the wx-users mailing list