lua-users home
lua-l archive

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

I'm not a regular C programmer. I need to look up the table
of operator precedence every darn time. Therefore there is
nothing natural in C's preference structure to me.

I'm coding my first project that is written in Lua 5.3 right from
the start. Gone are those mysterious n%16 and floor(int/16)
computations, in come n>>4 and n&0xf which say ever so
much more clearly what I mean. :-/

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?