This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: Patch for isdigit/isalpha/etc. macro arguments


Daniel Jacobowitz <drow@false.org> writes:
> I think we should decide whether this constitutes a Real Problem,
> and whether we care about it, before we do this.  It seems that
> passing a char to isfoo is not portable, although I could not tell for
> sure from the discussion whether ISO C requires it to work.

ISO C requires you to pass 0..255 or EOF, nothing else, to is*().

If the char might be signed, one must either cast it to unsigned char
or mask it with 0xff before using it as a subscript, else one risks a
negative subscript.  Negative values aren't guaranteed to work with
is*(), although some implementations put a second copy of the ctype
data array in front of the normal one to accomodate values in the
range -128..-1.  I suspect this is mostly to keep uninformed
programmers from bothering the mailing lists with complaints about
is*() not working when really it's the programmer's fault.


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