nmh-workers
[Top] [All Lists]

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

2013-02-04 21:16:30
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
value).

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.

David

_______________________________________________
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>