scanf(3) patch for C99-conformant FP parsing

Garance A Drosihn drosih at rpi.edu
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 gilead.netel.rpi.edu
Senior Systems Programmer           or  gad at freebsd.org
Rensselaer Polytechnic Institute    or  drosih at rpi.edu


More information about the freebsd-standards mailing list