[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (work1) now available
- From: David Given <dg@...>
- Date: Mon, 18 Jan 2010 14:49:04 +0000
-----BEGIN PGP SIGNED MESSAGE-----
On 18/01/10 14:40, Roberto Ierusalimschy wrote:
> Just a remind: at least we would be in good company, as ANSI C does not
> offer this operation too :)
> ISO/IEC 9899:1999 (E)
> The result of E1 >> E2 is E1 right-shifted E2 bit positions. If E1
> has an unsigned type or if E1 has a signed type and a nonnegative
> value, the value of the result is the integral part of the quotient of
> E1 / 2E2. If E1 has a signed type and a negative value, the resulting
> value is implementation-defined.
Luckily, one of C's many dirty little secrets is that
'implementation-defined behaviour' involves sign extension on pretty
much every compiler!
This is another example of why I think C's shifting behaviour is so mad.
Luckily, we don't have to repeat C's mistakes.
┌─── ｄｇ＠ｃｏｗｌａｒｋ．ｃｏｍ ───── http://www.cowlark.com ─────
│ "Money is a sign of poverty." --- Iain Banks
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----