On Wed, 11 Apr 2007 10:44:09 BST, Peter Maydell said:

> I'm not sure, but I think that the problem is to do with 'signed'
> vs 'unsigned' char. isalpha() et al want a value which is an unsigned
> char. If on some platform char is signed and we do something like:
> 
>   isalpha((int)*p)  /* p is a 'char *' */
> 
> and whatever char p points to is in the -ve range then isalpha is
> entitled to blow up.

Linus Torvalds recently had a longish rant on the Linux-Kernel list regarding
why passing functions signed or unsigned chars to a function whose prototype
contains just 'char' is a complete crock.  Basically, there's two cases - one
where signed and unsigned are treated identically, in which case the signedness
is superfluous.  In the other case, the function is by definition buggy (or at
least non-portable), because if it works *right* if passed an explicit "signed
char", it will blow up if compiled on a system where char defaults to unsigned,
and passed a 'char'.



Attachment: pgpRYrXi28tq8.pgp
Description: PGP signature

_______________________________________________
Nmh-workers mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/nmh-workers

Reply via email to