V
Voom
I want to set the locale, and use it in most of my application.
However, in certain legacy compilation units I want the ctype
functions to use the C (ASCII) locale--I want them to be insensitive
to the locale. In particular, I am thinking of the functions:
isalpha()
isalnum()
isgraph()
isupper()
islower()
isspace()
While it is simple enough to write my own version of these functions,
I see in Linux /usr/include/ctype.h the macro __NO_CTYPE. It looks as
if it might do this for me:
// Ignore the locale
#define __NO_CTYPE
#include <ctype.h>
#undef __NO_CTYPE
but that looks very non-portable--I did not even bother trying it.
But it makes me wonder if there is such a thing.
Is there an officially supported macro similar to __NO_CTYPE that
allows me to make some compilation units insensitive to the locale,
while others remain sensitive to the locale?
FYI, I am coding in C++ and compiling with g++, yet posting in
comp.lang.c because these are C functions.
However, in certain legacy compilation units I want the ctype
functions to use the C (ASCII) locale--I want them to be insensitive
to the locale. In particular, I am thinking of the functions:
isalpha()
isalnum()
isgraph()
isupper()
islower()
isspace()
While it is simple enough to write my own version of these functions,
I see in Linux /usr/include/ctype.h the macro __NO_CTYPE. It looks as
if it might do this for me:
// Ignore the locale
#define __NO_CTYPE
#include <ctype.h>
#undef __NO_CTYPE
but that looks very non-portable--I did not even bother trying it.
But it makes me wonder if there is such a thing.
Is there an officially supported macro similar to __NO_CTYPE that
allows me to make some compilation units insensitive to the locale,
while others remain sensitive to the locale?
FYI, I am coding in C++ and compiling with g++, yet posting in
comp.lang.c because these are C functions.