[Top][All Lists]

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

Re: [Nmh-workers] Development Questions. check Programs. register.

From: Ralph Corderoy
Subject: Re: [Nmh-workers] Development Questions. check Programs. register.
Date: Wed, 19 Oct 2016 15:14:17 +0100

Hi Tom,

> I've never heard of an implementation not using -1, though.

Me neither, and that's what the code's depending on thus the #error
otherwise.  (Would be quite interesting to find such a platform.  :-)

> >     extern int ctype_identity[257]; /* [n] = n-1 */
> >     #define isupper(c) ((isupper)((ctype_identity + 1)[c]))
> I'm not sure what the point is here, but have you considered that the
> input might be either signed or unsigned char?  If it's signed, this
> coding won't work.

IIRC from the git commit log, this is attributed as your idea.  :-)  The
compiler will warn if type char is used as an array index, regardless of
whether it's signed or unsigned here, because it might be signed
elsewhere and the code wouldn't work as expected.  So the above needs c
to be of type unsigned char, for example, to avoid the compiler warning.
It's the warning we're after to catch `isdigit(*s)' instead of
`isdigit((unsigned char)*s)'.

Cheers, Ralph.

reply via email to

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