nmh-workers
[Top] [All Lists]

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

2016-10-19 09:27:52
Ralph Corderoy <ralph(_at_)inputplus(_dot_)co(_dot_)uk> writes:
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)'.

Ah, I see.  In the Postgres project we're relying on specific buildfarm
members whose ctype.h macros actually still use arrays to catch this.
Putting in your own layer is a cute idea.  If I suggested it, it must've
come from a brain cell I don't have anymore.

                        regards, tom lane

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