"Jarrett Billingsley" <[email protected]> wrote in message 
news:[email protected]...
On Sun, Apr 12, 2009 at 9:28 AM, bearophile <[email protected]> 
wrote:
>
> Your C code also contains a bug, if chars are unsigned.
>
> I will agree, however, that the D compiler (*all* compilers for all
> languages, really!) should detect and complain about "nontrivial
> trivial" comparisons - comparisons that *look* nontrivial (like "c >=
> 0"), but which always evaluate to true or always to false.

I agree with what you're saying about "nontrivial trivial comparisons", but 
I'm inclined to also suggest that arithmetic operations be disallowed for 
char types. It doesn't make any more semantic sence than trying to add a 
string with an int. Plus, the concept of signed/unsigned for a "character" 
is rather nonsensical as well.

If you want to manipulate chars like that, you're not really looking to 
manipulate the characters themselves, you're looking to manipulate the 
underlying numerical codes. So a cast to a numeric type should be required. 


Reply via email to