Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jun 2003 14:49:22 -0400
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Andrey Chernov <ache@nagual.pp.ru>, standards@freebsd.org
Cc:        das@freebsd.org
Subject:   Re: scanf(3) patch for C99-conformant FP parsing
Message-ID:  <p0521063ebb1e4c770918@[128.113.24.47]>
In-Reply-To: <20030624124233.GA83552@nagual.pp.ru>
References:  <20030624114418.GA58305@HAL9000.homeunix.com> <20030624124233.GA83552@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
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@gilead.netel.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p0521063ebb1e4c770918>