vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On 3/30/06, Garance A Drosihn <drosih@rpi.edu> wrote: > The stupid thing in these routines is that the behavior is > UNDEFINED for values outside the correct range. We would > probably be doing ourselves (as programmers) a favor if we > made it a major error to pass in any negative value other > than the value for EOF. Many programmers have read the > description of these routines, and never quite understood > that these routines do *not* take a parameter of 'char'. i've thought about making all invalid values false. while the current openbsd implementation is safe, isdigit('1' + 256) returns true! something like int isdigit(int c) { return c == EOF ? 0 : c < CHAR_MIN ? 0 : c > UCHAR_MAX ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _N)); } |
| Thread Tools | |
| Display Modes | |
|
|