[klibc] isspace() and other ctype.h functions

H. Peter Anvin hpa at zytor.com
Wed Nov 12 08:38:29 PST 2003


Kai Germaschewski wrote:
> On Tue, 11 Nov 2003, Greg KH wrote:
> 
> 
>>__ctype_inline int isspace(int __c)
>>{
>>  return __ctypes[__c+1] & __ctype_space; */
>>}   
> 
> 
> Side remark: Is this supposed to crash if one passes an __c outside the 
> allowed range (ie < -1 || >= sizeof(__ctypes) - 1)?. My understanding of 
> the man page is that it should return 0, not "undefined behavior".
> 

Quoth POSIX:

"The c argument is an int, the value of which the application shall 
ensure is a character representable as an unsigned char or equal to the 
value of the macro EOF.  If the argument has any other value, the 
behavior is undefined."

	-hpa



More information about the klibc mailing list