Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Compiler warnings again
- X-seq: zsh-workers 5981
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: Compiler warnings again
- Date: Tue, 30 Mar 1999 09:14:08 +0200 (MET DST)
- In-reply-to: "Bart Schaefer"'s message of Mon, 29 Mar 1999 19:50:45 -0800
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> ../../../zsh-3.1.5/Src/Zle/compctl.c: In function `comp_setunset':
> ../../../zsh-3.1.5/Src/Zle/compctl.c:2312: warning: integer overflow in expression
> ../../../zsh-3.1.5/Src/Zle/compctl.c:2313: warning: integer overflow in expression
...never seen such a warning. But the reason is clear: the code uses
bit-masks to make the special parameters visible or not and an
expression like `(1<<num)-1' for `all parameters'. And the number of
parameters (including the `compstate' keys) has just reached
31. Ahem. If we add one more, I'll have to think about some other way,
but for now, I hope the thing below keeps the compiler quiet. Right?
Bye
Sven
diff -u os/Zle/comp.h Src/Zle/comp.h
--- os/Zle/comp.h Mon Mar 29 11:49:31 1999
+++ Src/Zle/comp.h Tue Mar 30 09:09:54 1999
@@ -309,4 +309,4 @@
#define CP_NUM 31
-#define CP_ALLMASK ((1 << CP_NUM) - 1)
+#define CP_ALLMASK ((int) ((((unsigned int) 1) << CP_NUM) - 1))
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author