Re: Reference equality between objects
| From: | Andrey Hristov | Date: | Fri, 24 Sep 2004 08:39:55 +0000 |
| Subject: | Re: Reference equality between objects | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-12962@lists.php.net to get a copy of this message | ||
Hi,
can we have a macro that implements this equality check - whether
2 zvals point to the same object?
Andrey
Andi Gutmans wrote:
You also have to compare Z_OBJ_HT_P(objA) == Z_OBJ_HT_P(objB) in addition to Z_OBJ_HANDLE_P. After checking both of these your code will work. At 10:57 PM 9/23/2004 -0700, Robert Silva wrote:Just wondering if there is a better way to test for reference equality than what is listed below. zval *objA; zval *objB; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oo", &objA, &objB) == FAILURE) {return;} // Reference equality only if (Z_OBJ_HANDLE_P(objA) == Z_OBJ_HANDLE_P(objB)) {RETURN_TRUE} RETURN_FALSE Also, should one be using zend_parse_method_parameters instead of the older zend_parse_parameters now for object method functions or does it really matter? Thanks Bob Silva aka Salty``` -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php