[tlbuild] -funsigned-char is not portable

Jonathan Kew jfkthame at googlemail.com
Wed Jun 3 15:30:14 CEST 2009


On 3 Jun 2009, at 14:21, Vladimir Volovich wrote:

> Hi!
>
>> the proper flag for this compiler is -qchars=unsigned which should be
>> tested via configure (if there is such a test), or -funsigned-char
>> should be removed.
>
> there is a test which is close to this one (but not quite the same, as
> it also suppresses warnings about "usage of char-type to index a  
> value-field"):
>
> http://www.nongnu.org/autoconf-archive/ac_prog_cc_char_subscripts.html
>
> Best,
> v.

Surely the correct fix is to ensure that the code does not depend on  
whether chars are signed or unsigned by default, as IIRC the C  
standard says this is implementation-defined, and there's no guarantee  
that every compiler even has an option to control it. If the code  
requires that char-sized variables are unsigned, it should simply  
declare them as "unsigned char", not assume it can rely on a compiler  
option.

JK



More information about the tlbuild mailing list