lua-users home
lua-l archive

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


> 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