-----Original Message----- From: Robert Elz [mailto:kre@munnari.OZ.AU] Sent: Tuesday, December 06, 2005 10:20 PM To: Arthur David Olson Cc: tz@lecserver.nci.nih.gov Subject: Re: changes to zdump.c and zic.c invocations of is.* macros Date: Tue, 6 Dec 2005 13:35:15 -0500 (EST) From: Arthur David Olson <olsona@elsie.nci.nih.gov> Message-ID: <200512061835.jB6IZFWH007741@elsie.nci.nih.gov> | ! while (isascii((unsigned char) *cp) && You sometimes do better if you write that as while (isascii(*(unsigned char *)cp) && It can also be a little clearer what you're intending - there's no intention here to fetch the char, then convert it to unsigned, all we want is the 0..255 value that cp points at. Than again, and I haven't looked at the code again just now to see if it is practical or not, but an alternative might just be to declare cp as being unsigned char * right from the start (even if that means that it needs to stop being an input parameter, and instead be copied from one which would need to remain char * to avoid changing the API). kre ps: I don't think Paul's suggested variation is really the right thing to do - it is certainly true that it's possible to test for digits by using >= '0' && <= '9' tests - but if that's the best way to write it, then that's what isdigit() ought to be doing. If you want to make it shorter, it is safe to stop the isascii() test if the arg is known to be unsigned char which after this change, it will be (or EOF, but that's irrelevant here). Paul's version may be textually shorter, but with that cp++ side effect buried in the middle of the && sequence, it is not nearly as easy to read.