Shifting question
John F. Haugh II
jfh at rpp386.UUCP
Fri Jul 22 10:42:17 AEST 1988
In article <11592 at steinmetz.ge.com> davidsen at crdos1.UUCP (bill davidsen) writes:
> If I sound really disgusted about this, I am. Compilers on brain
>damaged hardware should work correctly.
i have to disagree. the only way to inform the compiler that the shift
will always be by a positive amount is to cast the shift count to an
unsigned and the only way to inform the compiler the value is in range
is to have subranges ala pascal.
C does not have subranges as pascal has and expecting bounds checking on
all shift operations seems to deviate from the standard C idiom of little
or no run time checking. C does not check array bounds, even where it is
possible, and it should not be forced to check shift counts.
- john.
--
John F. Haugh II +--------- Cute Chocolate Quote ---------
HASA, "S" Division | "USENET should not be confused with
UUCP: killer!rpp386!jfh | something that matters, like CHOCOLATE"
DOMAIN: jfh at rpp386.uucp | -- with my apologizes
More information about the Comp.lang.c
mailing list