2 ms·
The comment here suggests why: http://osxr.org/glibc/source/ctype/ctype.h http://osxr.org/glibc/source/ctype/ctype.h I'd considered a table-driven approach - I
by to3m 11y ago
The comment here suggests why: http://osxr.org/glibc/source/ctype/ctype.h http://osxr.org/glibc/source/ctype/ctype.h
I'd considered a table-driven approach - I mean, perhaps it's a bit daft for isblank, but OK for some of the more random categories - but assumed they'd index on c&0xFF or something, rather than just using the int input verbatim!
It's not immediately obvious to me why that wasn't done (maybe glibc has to support one's complement?), since none of the high-bit ASCII chars appear to have a defined value. Then you can decide EOF is -1 - no reason not to - and it would capture that as well. (The functions don't appear to have a defined output for EOF, even though it's a defined input, so it could just shared the same output as (signed char)-1, and that would be OK. At least it's not a crash.)