Re:Proposal for a Friendly Dialect of C
by jhallenworld on Wednesday August 27, 2014 @09:28PM
(#8235521)
Friendly C should also require char to be unsigned so that this code is safe:
[ Parent
| on HN ]
Re:Proposal for a Friendly Dialect of C
by kazinator on Wednesday August 27, 2014 @09:31PM
(#8235531)
More to the point, char should be unsigned so that this code is safe:
#include <ctype.h>
if (isdigit(str[i])) { ... }
The ctype functions require an int-valued argument which is the value of an unsigned char: it must be a positive value, or the negative value EOF.This is an unfriendly pitfall in the language.