Hi again Dmitry, ----- Original Message ----- From: "Dmitry Stogov" Sent: Thursday, July 31, 2008
> Hi Matt, > > For now I would like to disable "-CONST" constant expression which > started to work after your patch. > > Later we are able to implement the complete constant expressions support. One more updated thing to ask about. :-) From the last reply, I wasn't sure if constant folding in zend_do_[binary|unary]_op() could be added (for negative numbers, ORing function flags that were substituted, ~0, 1024 * 1024, etc.) or it was desired to wait for "complete constant expressions support" (in static_scalar context), though I don't see any relation between that, which is an actual language change, and this easy optimization that's only internal (and more useful now with constant substitution). So I updated the patch, which is the same code as before, but without trying to add partial expression support to static_scalar. Seems pretty simple/safe, with basically just the if () { } block added in zend_do_[binary|unary]_op(). :-) The rest updates the unary_op_type typedef (was missing TSRMLS_DC), adds binary_op_type, and updates get_binary_op (half the patch!). The couple changes in the parser, which CAN be ignored if desired, are mostly a cleanup, but '+' static_scalar now actually "does something" like the unary + operator in regular contexts. As I showed before, it makes the following consistent: function foo() { static $a = -'abc'; // 0 static $b = +'abc'; // abc $c = +'abc'; // 0 } http://realplain.com/php/const_folding.diff http://realplain.com/php/const_folding_5_3.diff Well, I don't know if it can be tossed in quickly at this time, but there ya go since I think it's pretty basic! ;^) > Thanks. Dmitry. Thanks, Matt -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php