October 03, 2001 Re: bool is not an integer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to a | In article <3BBA7764.458FBFCF@b.c>, "a" <a@b.c> wrote:
> Funny, I always thought that the precedence of boolean operators were
> as well understood and standard as those of addition and multiplication.
> Should we require explicit parens around all infix and unary
> operations?
> I had AND taught to me as boolean multiplication and OR taught as
> boolean addition. XOR and implication was always a bit of gray area,
> but AND and OR were well defined. I'd hate to clutter the expressions
> in the cases were it isn't really needed.
Yes, most of the problems seem occur when mixing other things in, e.g., &, &&, ^, <<, etc.
|
October 03, 2001 Re: bool is not an integer? | ||||
---|---|---|---|---|
| ||||
Posted in reply to a | a wrote: > Ben Cohen wrote: > >> In article <9pbvn5$1bes$1@digitaldaemon.com>, "Roberto >> Mariottini" <mario@jonathan.torino.artis.it> wrote: >> >> >>> In article <9p29du$233h$1@digitaldaemon.com>, "Walter" >>> <walter@digitalmars.com> writes: >>> >>> >>> gcc suggests to use explicit parenthesis aound && within >>> ||, and I think this should be mandatory for D. >>> >> I agree. Some C style guides recommend doing this sort of >> thing. Rather than changing the precedence, we can >> just remove it. >> > > Funny, I always thought that the precedence of boolean > operators were as well understood and standard as those of > addition and multiplication. Should we require explicit > parens around all infix and unary operations? I had AND > taught to me as boolean multiplication and OR taught as boolean > addition. XOR and implication was always a bit of gray > area, but AND and OR were well defined. I'd hate to > clutter the expressions in the cases were it isn't really > needed. > > Dan > In the context of mathematical logic, I was taught that they had the same precedence, and that parenthesis was always required if both operations were preformed. |
Copyright © 1999-2021 by the D Language Foundation