为什么左移unsigned int
32次会产生以下警告?
pthr.c: In function ‘main’:
pthr.c:4: warning: left shift count >= width of type
即使sizeof(unsigned int)
在我的系统上是4个字节。
代码:
#include<stdio.h>
int main(void)
{
unsigned int mask = 1u << 32;
printf("sizeof(unsigned int) = %u\n", sizeof(unsigned int));
return 0;
}
gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.