isblank patch

Howland Craig D (Craig) howland@LGSInnovations.com
Wed Oct 15 20:56:00 GMT 2008


Charlie:
     Both good points that I had thought of but failed to mention in my
email.  Thanks for pointing them out.  (newlib does not actually support
changing the locale information, but it's still probably best to steer
clear of it, which scuttles the inline idea as you say.  Another
possible
reason against inlining is older compilers and GCC differing from C99
for a long time on them, etc.)
				Craig

-----Original Message-----
From: Charlie Gordon [mailto:news@chqrlie.org] 
Sent: Tuesday, October 14, 2008 1:07 PM
To: Howland Craig D (Craig); newlib@sourceware.org
Subject: Re: isblank patch

Why not make isblank a self expanding macro and an inline or extern
function 
?

static inline isblank(int c) { return c == ' ' || c == '\t'; }
#define isblank(c) ((isblank)(c))

This way isblank is a macro whose presence can be correctly detected
with 
#ifdef

Thinking twice about this, I think isblank should be locale specific per

C99:

7.4.1.3 The isblank function
Synopsis
1 #include <ctype.h>
int isblank(int c);
Description
2 The isblank function tests for any character that is a standard blank 
character or is one
of a locale-specific set of characters for which isspace is true and
that is 
used to
separate words within a line of text. The standard blank characters are
the 
following:
space (' '), and horizontal tab ('\t'). In the "C" locale, isblank
returns 
true only
for the standard blank characters.

What a bloody shame!

Chqrlie.



More information about the Newlib mailing list