[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ternary operator patch
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 16 Sep 2010 09:29:21 -0300
> Lua has quite fewer operator priorities than C (and Pascal has even
> fewer), and I should like to see evidence that more people get confused
> by the operator priorities of Pascal than those of C.
Pascal was quite confusing for me. I could never remember to add
parentheses to expressions like "x >= 0 and x <= 10". To give 'and'
and '*' the same priority is an example of a logical, simple, and bad
decision.
C has more priorities than Lua because it has (much) more operators. If
you consider only the common subset, operators in Lua and C have
basically the same priorities. (I think the only difference is that
in C '==' has lower precedence than '<'; in Lua they have the same
precedence.)
A (the?) great source of confusion in C priorities is '&' and '|',
which for historical reasons have a "wrong" priority.
-- Roberto
- References:
- Re: Ternary operator patch, Doug Rogers
- Re: Ternary operator patch, Ryota Hirose
- Re: Ternary operator patch, Ryota Hirose
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Miles Bader
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Ryota Hirose
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Ryota Hirose
- Re: Ternary operator patch, David Kastrup