Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!ames!hc!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.c Subject: Re: int divided by unsigned. Message-ID: <13958@lanl.gov> Date: 27 Jun 89 03:13:08 GMT References: <1549@frog.UUCP> Distribution: na Organization: Los Alamos National Laboratory Lines: 22 From article <1549@frog.UUCP>, by john@frog.UUCP (John Woods): > main() { > int a = -5; > unsigned b = 1000; > printf("%d\n", a /= (int)b); > } > A correct program giving desirable results. Fancy that. And all it requires is some non-intuitive (and undesireable) clutter in the expression. It would _obviously_ be better if the semantics of the given expression were the _default_ and the present default were the one which required the extra syntax. That is, all the following would be _equal_: a /= b, (int)a /= b, a /= (int)b, (int)a /= (int)b and, to get the current interpretation, you should have to do: (unsigned)a /= b But, that would require C to do something in a reasonable way - so I guess we can forget that.