scanf(3) patch for C99-conformant FP parsing

Garance A Drosihn drosih at
Tue Jun 24 11:49:27 PDT 2003

At 4:42 PM +0400 6/24/03, Andrey Chernov wrote:
>BTW, in all cases calling is*() macros on char may have side
>effects, you need to promote argument to (unsigned char) first.

For what it's worth, I like to use the following #define'd
macros for using the is*() and to*() routines with byte
values.  These have worked well for me, if for no other
reason than they explicitly remind me that I have to do
something for char types...

  * All the standard is*() routines are defined to work on an 'int',
  * in the range of 0 to 255 plus EOF (-1).  So we define wrappers
  * which can take values of type 'char', either signed or unsigned.
#define isdigitch(Anychar)    isdigit(((int) Anychar) & 255)
#define isupperch(Anychar)    isupper(((int) Anychar) & 255)
#define isxdigitch(Anychar)   isdigit(((int) Anychar) & 255)
#define tolowerch(Anychar)    tolower(((int) Anychar) & 255)

Garance Alistair Drosehn            =   gad at
Senior Systems Programmer           or  gad at
Rensselaer Polytechnic Institute    or  drosih at

More information about the freebsd-standards mailing list