ccr
ccr

Reputation: 81

How to understand the 3 lines of c code?

 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) {
  return;
 }

Especially what's ZEND_NUM_ARGS() TSRMLS_CC doing?

Upvotes: 5

Views: 755

Answers (4)

xscott
xscott

Reputation: 2430

It looks like TSRMLS_CC is a macro that might expand to nothing or it might expand to an extra argument with a comma thrown in there:

http://blog.golemon.com/2006/06/what-heck-is-tsrmlscc-anyway.html

Upvotes: 5

codaddict
codaddict

Reputation: 455360

This Zend article says:

The bulk of the zend_parse_parameters() block will almost always look the same. ZEND_NUM_ARGS() provides a hint to the Zend Engine about the parameters which are to be retrieved, TSRMLS_CC is present to ensure thread safety

Upvotes: 4

Related Questions