Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Zle patch - termok change
- X-seq: zsh-workers 2973
- From: Zefram <zefram@xxxxxxxxxxxxxxxxx>
- To: gwing@xxxxxxxxxxxxxxx
- Subject: Re: Zle patch - termok change
- Date: Fri, 7 Mar 1997 15:03:27 +0000 (GMT)
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <19970307072357.19867.qmail@xxxxxxxxxxxxxxx> from "gwing@xxxxxxxxxxxxxxx" at Mar 7, 97 06:23:57 pm
gwing@xxxxxxxxxxxxxxx wrote:
>termok == 0 indicates a `normal' working terminal - this is *opposite* to
> the previous situation.
Perhaps it should be renamed to termbad then.
>+ /* flag defines */
>+ #define issetflag(X, Y) ((X & (Y)) == Y)
>+ #define isanysetflag(X, Y) (X & (Y))
>+ #define setflag(X, Y) X |= (Y)
>+ #define unsetflag(X, Y) X &= ~(Y)
Yuck. issetflag() evaluates Y twice, and there aren't enough parentheses.
The fully parenthesised forms are:
#define issetflag(X, Y) (((X) & (Y)) == (Y))
#define isanysetflag(X, Y) ((X) & (Y))
#define setflag(X, Y) ((X) |= (Y))
#define unsetflag(X, Y) ((X) &= ~(Y))
But why bother with these macros anyway? We've always been happy with
the (much clearer) plain bit operations anyway.
-zefram
Messages sorted by:
Reverse Date,
Date,
Thread,
Author