Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Casting ctype lookups

On Thu, Nov 15, 2012 at 06:46:07AM -0500, D'Arcy J.M. Cain wrote:
> As I recently posted, even if I add -funsigned-char to the compile I
> still get the warning.  It seems that gcc ignores its own flag.

You misunderstand. If you explicitly declare the argument as unsigned char,
you do not get the warning:

#include <ctype.h>
char func(unsigned char c)
        return toupper(c);

If you use "char c" instead, no matter wether you have signed or unsigned
chars, you get the warning.

I consider this behaviour correct, otherwise it would hide the warning
if you happen to compile for an arch with signed chars.


Home | Main Index | Thread Index | Old Index