Re: Re: Please help with the bidi Emacs

Behdad Esfahbod <[email protected]>
Newsgroups gmane.emacs.bidi,gmane.comp.internationalization.arabeyes.devel
Message-ID <[email protected]>
On Sun, 25 Apr 2004, ahmad khalifa wrote:
> > >
> > >   if (!(type == STRONG_R
> > > 	|| type == STRONG_L
> > > 	|| type == WEAK_BN
> > > 	|| type == WEAK_EN
> > > 	|| type == WEAK_AN
> > > 	|| type == NEUTRAL_B
> > > 	|| type == NEUTRAL_S
> > > 	|| type == NEUTRAL_WS
> > > 	|| type == NEUTRAL_ON))
> > >     abort ();
> >
> >Can you tell why you think it needs more parentheses?  It basically
> >says
> >
> >   if (!(expression))
> >     abort ();
> >What's wrong with that, and why would an additional pair of enclosing
> >parens fix that?
>
> are you sure expression is evaluated correctly ? thats what the parens
> are for... 1 month ago i would have never thought that this would be a
> problem, but after debugging minibidi line by line, i found out that
> sometimes this happens, probably because ' || ' and ' == ' have the same
> evaluation priority or something.

Apparently not in this case.  And no, they don't have the same
priority.  The idiom is that something like this:

(a == b || c == d && e == f || g == h)

Works as you expect:

((a == b) || ((c == d) && (e == f)) || (g == h))


--behdad
  behdad.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.