[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Biggest gotcha in Lua 5.3.0
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 13 Jan 2015 09:25:01 -0200
> Or do they? I've spent hours of debugging time already
> on discovering and rediscovering that n%16+1 and
> n>>4+1 etc do not give the same result.
>
> Why on earth, except that C does it, must an operation
> that feels like a multiplication, if not an exponentiation,
> have lower priority than addition?
There is no "cultural" rule for the priorities of these operators,
except that used by C and (as far as I know) almost every other language
that offers those operators. I must confess I myself have no feelings
at all about all bitwise operations, and I always use parentheses with
them.
-- Roberto