int divided by unsigned.

Jim Giles jlg at lanl.gov
Tue Jul 11 16:12:08 AEST 1989


>From article <1578 at mcgill-vision.UUCP>, by mouse at mcgill-vision.UUCP (der Mouse):
> [...]
> Really?  As in 65500U / 6 giving -6 (sixteen bit ints)?[%]  Take your
> pick, you get either that -100 / 10U giving 654.  [...]

If you've really been following this discussion, you will remember that
my _favorite_ fix for the mixed mode problem is to promote _both_ operands
to long.  This would give 65500/6 == 10916 _AND_ it would give -5/1000u == 0.
Of course, as someone also pointed out, C foolishly doesn't require 'short',
'int', and 'long' to be different data types.  Oh well.



More information about the Comp.lang.c mailing list