Mail Archives: djgpp/1994/03/29/20:32:42
> Hi
> Please, look at the following chunk of code,
> and compilation results, and tell me, can I ignore
> the warning,and must there be a worning at all???
> main()
> {
> long UR=1;
> if (sizeof(long)>4)
> {
> UR=UR<<32;
> }
>
> }
> here's the compilation output:
> bug.c: In function `main':
> bug.c:6: warning: left shift count >= width of type
I take it you are NOT using -O? This code *should* optimize out because:
sizeof(long)=4, therefore the conditional will ALWAYS be false, and NEVER
execute.... however, if you're not using -O, gcc probably won't look for
such dead code.
Better would be:
#define 32BITS
#ifdef 32BITS
UR=UR<<32;
#endif
damn shame you can't do #ifdef sizeof(long)>4 .... #endif....
but it's not supported *sigh*
- Raw text -