nmh-workers
[Top] [All Lists]

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

2013-02-05 09:50:09
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.

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>