[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (work1) now available
- From: Miles Bader <miles@...>
- Date: Sun, 10 Jan 2010 00:30:45 +0900
Rene Rebe <rene@exactcode.de> writes:
>> There are better ways to write that, and you should use them...
>> expecting fractions to silently be dropped is just plain dodgy.
>>
>> [e.g., = bit.band (bit.rshift (0xffff, 8), 0xff) ]
>
> I know this and all the details. Been there, done that.
... and yet you're still using bad code like you quoted?
> I already wrote that the concern is about least surprise and coding
> style. I do not consider using bit.Xshift or math.{round,ceil,floor}
> everywhere to be especially beautiful nor readable (reviewable,
> maintainable) code.
If you're operating on an integer value that, you expect to use as a
bitmask etc, then using integer operations with well-defined bit-level
behavior leads to _less_ surprising behavior.
-Miles
--
Justice, n. A commodity which in a more or less adulterated condition the
State sells to the citizen as a reward for his allegiance, taxes and personal
service.