lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> 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

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

A (the?) great source of confusion in C priorities is '&' and '|',
which for historical reasons have a "wrong" priority.

-- Roberto