lua-users home
lua-l archive

Re: code generation bug

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


On OS X PowerPC:
<<
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
=1 or false
1
=1 and true
true
=true or false
true
=((1 or false) and true) or false
1
<<
Indeed seems funny that combining expressions with paranthesis has different result than having them as separate expressions.
-asko
On 2009年4月15日 21:37:25 -0700
 "Kelley, Brian" <bkelley@qualcomm.com> wrote:
I was surprised to notice the following:
 Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
 > =((1 or false) and true) or false
 1
Same results on 5.1.2 and 5.1.3, MacOS and Windows.
For what it's worth, I observed in lcode.c that the OPR_AND expression inherited the 'k' (kind) of VTRUE from its rhs subexpression, which seems wrong and seems to throw off the subsequent call to luaK_goiffalse().
-bhk

AltStyle によって変換されたページ (->オリジナル) /