From: Michael Castle Subject: Re: Sizeof bug??? To: mitnits AT bgumail DOT bgu DOT ac DOT il (Roman Mitnitski) Date: Tue, 29 Mar 1994 19:15:39 -0600 (CST) Cc: djgpp AT sun DOT soe DOT clarkson DOT edu > 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*