How to understand the 3 lines of c code?
Asked Answered
M

4

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

Especially what's ZEND_NUM_ARGS() TSRMLS_CC doing?

Moats answered 16/11, 2010 at 6:42 Comment(5)
the short answer would be...read the documentation; see google.com/search?q=ZEND_NUM_ARGS%28%29Neukam
@Steven: Actually, that is C code for the PHP language.Daybreak
That looks like C code for a PHP extension.Holster
@Bolt I stand (sit, actually) corrected; which 10 seconds with the documentation available from google told me right after i clicked the add comment button [you guys are fast!]Neukam
i expect this will be closed soon, since the OP has apparently expended no effort prior to posting, but i'll leave it alone...for nowNeukam
C
5

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

Childish answered 16/11, 2010 at 6:47 Comment(0)
R
4

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

Reyna answered 16/11, 2010 at 6:46 Comment(1)
Can you elaborate about TSRMLS_CC ?Moats

© 2022 - 2024 — McMap. All rights reserved.