Re: C and side-effects

From: Alan Modra (alan@linuxcare.com.au)
Date: Thu May 04 2000 - 05:50:29 EST


On Thu, 4 May 2000, George Anzinger wrote:

> c = (c - d)>>n + d;
>
> and tested for values of 0 < c < 40, 1 < d < 40 and 0 < n < 80.
>
> Turns out that gcc (and the hardware) tend to give unexpected results
> for n>32. I think the shift is done modulo 32. What does the standard
> have to say about this?

Basically that anything can happen if the shift count is greater than or
equal to the number of bits in the integral type being shifted.

-- 
Linuxcare.  Support for the Revolution.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:14 EST