Mail Archives: djgpp-workers/1998/02/04/00:36:48
IMHO, this discussion is both too long and pointless. Even though they
tend to be implemented as macros, the is* functions DO have the
following prototypes (Linux man patge for isupper):
int isalnum (int c);
int isalpha (int c);
int isascii (int c);
int isblank (int c);
int iscntrl (int c);
int isdigit (int c);
int isgraph (int c);
int islower (int c);
int isprint (int c);
int ispunct (int c);
int isspace (int c);
int isupper (int c);
int isxdigit (int c);
Even if these functions were implemented as functions rather than
macros, it wouldn't one bit of difference, passing a char (signed,
unsigned or ambiguous) would ALWAYS cause `unexpected' results, the
compiler will always do something funny when it extends the bits.
Basicly, anybody uses a char between fgetc and is* /DESERVES/ to have
their program break, seeing as how fgetc is declared as:
int fgetc(FILE *stream);
which is guaranteed to return a value between -1 and 255 (assuming
EOF==-1).
char c; /* or signed char or unsigned char */
c=fgetc(file);
if (isupper(c)) {}
Will, no matter what, give undefined results for EOF, but
int c;
c=fgetc(file);
if (isupper(c)) {}
is guaranteed to work.
So really, the djgpp ctype.h header file should just make sure c is in
the right range (don't want array bounds checking to fail) and be done
with it. Forget about coping with `char's of any flavour, they're
irrellevant.
If anybody disagrees with this, please tell me why.
Bill
--
Leave others their otherness.
- Raw text -