This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: isblank patch

     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
reason against inlining is older compilers and GCC differing from C99
for a long time on them, etc.)

-----Original Message-----
From: Charlie Gordon [] 
Sent: Tuesday, October 14, 2008 1:07 PM
To: Howland Craig D (Craig);
Subject: Re: isblank patch

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

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

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

C99: The isblank function
1 #include <ctype.h>
int isblank(int c);
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
space (' '), and horizontal tab ('\t'). In the "C" locale, isblank
true only
for the standard blank characters.

What a bloody shame!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]