nmh-workers
[Top][All Lists]
Advanced

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

Re: [Nmh-workers] Compiler warnings and signed vs. unsigned char, again


From: Ralph Corderoy
Subject: Re: [Nmh-workers] Compiler warnings and signed vs. unsigned char, again
Date: Tue, 05 Feb 2013 15:49:49 +0000

Hi,

Ken wrote:
> What they settled on was casting the arguments to the ctype
> functions/macros using (int) (unsigned char), which seems like
> overkill to me; I think really casting to unsigned char would be
> sufficient.

I too think strings should be char * and (unsigned char) used iff a char
is being passed to ctype(3).  Hopefully we have a (uchar) or similar we
can depend on which will lessen the noise.  The explanation for an
additional (int) that I've seen is to silence warnings from "some
compilers".  I'd suggest waiting to see if any of them are still around.
http://netbsd.gw.com/cgi-bin/man-cgi?ctype+3+NetBSD-current

David wrote:
> How about this:  use unsigned char everywhere we can internally and
> compile with gcc -funsigned-char/Solaris cc -xchar=u?

I haven't tried it but I don't think having gcc use unsigned chars will
silence it;  it's warning about the potential problem regardless of
whether you've optioned it away this time.

> Or maybe better:  we could funnel all C lib calls through macros that
> have the casts.  It's not as bad as it sounds, just throw some perl at
> it.

It's as bad as it sounds for readability;  one doesn't have to think
twice when reading calls to stdlib's functions.

Cheers, Ralph.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]