Re: warning: left shift count >= width of type

From: Jeremy Elson (jelson@blaze.cs.jhu.edu)
Date: 05/10/96


> Well, I have no idea why but I'm getting this damned message when compiling,
> and asa I log the mud crashes, All I was trying to do is to code a fourth att
ack =o)
> sorry gurus can anyone gimme some light?
> thanks. 
> WidowMaker 
> 
> act.offensive.c: In function `do_fourth':
> act.offensive.c:687: warning: left shift count >= width of type
> act.offensive.c:690: warning: left shift count >= width of type
> act.offensive.c:694: warning: left shift count >= width of type
> 
> ACMD(do_fourth)
> {
>   if (GET_CLASS(ch) != CLASS_WARRIOR) {
>       send_to_char("You are not able to do it!", ch);
>       return;
>    }
>    
> /* line 687 */   if ( IS_AFFECTED(ch, AFF_F_ATTACK) ){
>       send_to_char("You no longer use your ability.", ch);
>       REMOVE_BIT(AFF_FLAGS(ch), AFF_F_ATTACK);
> /* line 690 */      return;
>    } else {
>        send_to_char("Your ability is now ON! Let's FIGHT!!!!", ch);
>        SET_BIT(AFF_FLAGS(ch), AFF_F_ATTACK);
> /* line 694 */       return;
>       }
> }
> 
> I've defined the flag as:
> #define AFF_F_ATTACK	      (1 << 35)

Because that field is only 32 bits wide!  You can only have 32 flags
up to 1 << 31).



This archive was generated by hypermail 2b30 : 12/18/00 PST