You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ever wondered about the strange extra code for iscntrl() in ctype.h. I explicitly returns 0 for EOF(-1), and 1 for 255.
But i think that is wrong. In all environments where i tested it, only characters 0-31 and 127 return != for iscntrl, and in all cases both -1 and 255 return 0.
And there is also room for optimizations. Even if we want to keep the current behaviour, we do not need to explicitly check the 255 case. The same effect can be achieved by setting myctype[255] to zero. It would also by possible to get rid of the extra access through the _ctype pointer, and to make the array(s) unsigned char instead of int in order to save some space, essentially implementing it similar to libcmini.
Any suggestions?
The text was updated successfully, but these errors were encountered:
I ever wondered about the strange extra code for iscntrl() in ctype.h. I explicitly returns 0 for EOF(-1), and 1 for 255.
But i think that is wrong. In all environments where i tested it, only characters 0-31 and 127 return != for iscntrl, and in all cases both -1 and 255 return 0.
And there is also room for optimizations. Even if we want to keep the current behaviour, we do not need to explicitly check the 255 case. The same effect can be achieved by setting myctype[255] to zero. It would also by possible to get rid of the extra access through the _ctype pointer, and to make the array(s) unsigned char instead of int in order to save some space, essentially implementing it similar to libcmini.
Any suggestions?
The text was updated successfully, but these errors were encountered: