Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Zle patch - termok change



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