Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site allegra.UUCP Path: utzoo!linus!decvax!harpo!eagle!allegra!alan From: alan@allegra.UUCP (Alan S. Driscoll) Newsgroups: net.lang.c Subject: Beware: Hackers Message-ID: <2189@allegra.UUCP> Date: Sun, 8-Jan-84 14:38:19 EST Article-I.D.: allegra.2189 Posted: Sun Jan 8 14:38:19 1984 Date-Received: Mon, 9-Jan-84 01:55:20 EST Organization: AT&T Bell Laboratories, Murray Hill Lines: 28 From Roger Ferrel: What we see here with the: inttype *= 0.5; vs inttype = inttype * 0.5; is a weakness of most C compilers. It seems none of them handles float operations very well when there are mixed types. Of course the above is a poor example since normally more efficent code would be generated by using: inttype >>= 1; /* how is this for getting off the subject? */ From the C Reference Manual: The value of E1>>E2 is E1 right-shifted E2 bits. The right shift is guaranteed to be logical (0-fill) if E1 is unsigned; otherwise it may be arithmetic (fill by a copy of the sign bit). If the shift is logical, then negative values of "inttype" will give you interesting results. Alan S. Driscoll AT&T Bell Laboratories