nmh-workers
[Top][All Lists]
Advanced

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

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


From: Tom Lane
Subject: Re: [Nmh-workers] Development Questions. check Programs. register.
Date: Wed, 19 Oct 2016 10:27:40 -0400

Ralph Corderoy <address@hidden> 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



reply via email to

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