[Top][All Lists]

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

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

From: David Levine
Subject: Re: [Nmh-workers] Compiler warnings and signed vs. unsigned char, again
Date: Mon, 04 Feb 2013 22:16:12 -0500

Ken wrote:

> The real problem is this: while unsigned char is required
> to prevent sign extension from happening when using the
> ctype macros (because they take int), every OTHER string
> function takes an unqualified char *.  E.g., strcpy,
> strcmp, mbtowc(), etc etc.
> So you ended up with some wholesale interface changes,
> _and_ you had a bunch more cast's to (char *).  The whole
> thing felt wrong; it was too huge.

How about this:  use unsigned char everywhere we can
internally and compile with gcc -funsigned-char/Solaris cc
-xchar=u?  Preserving that suggests using our own unsigned
char type, though.

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.  I've done it in the past and
not regretted it.  We already have a mishmash with
mh_str{,n}casecmp and mh_x*alloc (though those has added

And it doesn't all have to be done at once.

> That seems to be what other packages have done.  This
> would mean we'd change back all current unsigned char *'s
> to just char *'s

That just doesn't seem right.


reply via email to

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