isblank patch

Jeff Johnston
Wed Oct 15 21:56:00 GMT 2008

Howland Craig D (Craig) wrote:
> A couple of minor touchups for the isblank() function.  ctype.h has it
> listed as being non-ANSI, but it is.  Additionally, isblank.c claimed
> that it was a macro yet ctype.h does not have a macro for it.  The
> attached patch moves the prototype in ctype.h so that it is there for
> and makes appropriate cleanups to the comments in isblank.c.  The patch
> file also includes a ChangeLog entry.
> (I decided not to create an isblank macro because it would have been
> messy to make a good one.  There are some to be found that do this:
> #define isblank(c)	((c) == ' '  ||  (c) == '\t')
> This form has the problem of evaluating the argument twice, which is
> undesirable.  I did not use the method presently in ctype.h for toupper
> and tolower because they are only defined for GCC and would not
> always be applicable, making a comment about it being a macro in the
> man page subject to error.)
> Craig Howland
Thanks Craig.

Actually, isblank is C99.  This is distinguished elsewhere in other C99 
newlib functions. 

Now, regarding the prototype, it should use the same check that is in 
place in math.h for C99
functions/types.  This check uses the same __STDC_VERSION__ logic used 
to set _USE_ISOC99
in glibc features.h.

To that end, I have checked in a modified change with the following 
ChangeLog entry.

2008-10-15  Craig Howland  <>

    * libc/include/ctype.h (isblank):  isblank is C99.
    * libc/ctype/isblank.c (isblank comments):  ditto.  isblank does not
    have a macro version (as was claimed in the description).

-- Jeff J.

More information about the Newlib mailing list