[Ilugc] Regarding gcc compiler in Linux
- From: mssnlayam@xxxxxxxx (Suriya Narayanan M S)
- Date: Tue Mar 1 20:13:17 2005
On Tue, Mar 01, 2005 at 02:24:48PM +0000, Sangharsha p g wrote:
unsigned int a=0xffffffff;
unsigned int b=a<<32;
gcc test.c
test.c: In function `main':
test.c:5: warning: left shift count >= width of type
Doesn't the warning clearly say what is wrong? An unsigned int is 32 bits
on the machine you are compiling, and the argument to the shift
instruction has to be between 0 and 31 (both inclusive). The compiler
would usually shift that by shiftamount % 32, which is 0 in this case and
I would expect b to be equal to a.
Suriya
Other related posts: