Yes, it is correct. The results are a consequence of the rule that after
automatic widening of types has occurred, if either operand is unsigned,
then the expression is evaluated with unsigned operands. When I was first
learning C, I made the very silly mistake of writing
char ch;
while ((ch = getchar) != EOF)
which would work on some compilers and not on others. Naturally, the diffi-
culty was that in some cases 'char' by default was unsigned, and so the
comparison was done using unsigned arithmetic.
---
Kenneth R. Ballou ...!ucbvax!cartan!brahms!ballou
Dept. of Mathematics
University of California
Berkeley, California 94720