[expr]: handling of negative literals
Closed / Fixed1564517fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 19 years ago
Descriptionplain2006-09-24 13:16:19
Negative numeric constants are stored as a positive
literal, and UMINUS is executed on it at runtime:
Command 1: "expr {$v > -99}"
(0) loadScalar1 %v0 # var "v"
(2) push1 0 # "99"
(4) uminus
(5) gt
This can be very costly if happens in a loop (see
http://groups.google.com/group/comp.lang.tcl/browse_frm/thread/b2a6592f802dfddc/82517b5f8bf2b145
dgpplain2006-09-25 07:58:18
Logged In: YES user_id=80530 I'd need to review the code to recall the details and rationale, but this is an intentional feature of the expr parser.
dgpplain2006-09-27 22:24:26
Logged In: YES user_id=80530 The expr parser has always aggresively interpreted "-" and "+" as operators. Looking into what the compiler can do to improve bytecode for this situation.
dgpplain2007-08-17 02:19:51
Logged In: YES user_id=80530 Originator: NO fixed in HEAD
Log in (anonymous is fine) to add a comment.