internals:review_comments

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

internals:review_comments [2013/01/09 11:58]
johannes Add note about setting RINIT/RSHUTDOWN NULL and having them small
internals:review_comments [2014/01/25 00:11] (current)
sixd Add title
Line 1: Line 1:
 +===== Common comments from reviewing PECL proposals =====
 +
 While reviewing PECL proposals there are some common issues which can be observed. This page collects some of those to provide extended information and saving reviewers from explaining those multiple times. This is different from other sections on this wiki a it focusses on review perspective. While reviewing PECL proposals there are some common issues which can be observed. This page collects some of those to provide extended information and saving reviewers from explaining those multiple times. This is different from other sections on this wiki a it focusses on review perspective.
  
Line 40: Line 42:
 #endif #endif
 </​file>​ </​file>​
 +
 +====== Don't use C99 for portability reasons ======
 +
 +C99 is more than 10 years old. Still compiler vendors (most notably Microsoft Visual C) have only limited support of C99 features. Using C99 in an extension code can therefore limit the portability. ​ C99 features include ​
 +
 +  * inline functions
 +  * intermingled declarations and code: variable declaration is no longer restricted to file scope or the start of a compound statement (block), similar to C++
 +  * several new data types, including long long int, optional extended integer types, an explicit boolean data type, and a complex type to represent complex numbers
 +  * variable-length arrays
 +  * support for one-line comments beginning with %%.//%%., as in BCPL or C++
 +  * new library functions, such as snprintf
 +  * new header files, such as stdbool.h, complex.h, tgmath.h, and inttypes.h
 +  * type-generic math functions
 +  * improved support for IEEE floating point
 +  * designated initializers
 +  * compound literals
 +  * support for variadic macros (macros with a variable number of arguments)
 +  * restrict qualification allows more aggressive code optimization
 +  * universal character names, which allows user variables to contain other characters than the standard character set
 +
 +(Source: [[http://​en.wikipedia.org/​wiki/​C99#​Design]])
 +
 +A common mistake is the second item. Note that the macro TSRMLS_FETCH() includes a variable declaration. This macro should be the last item in the variable declaration. Code like this is invalid, according to this rule:
 +
 +  static long myext_do_something() {
 +    long a, b;
 +    a = myext_get_a();​
 +    TSRMLS_FETCH();​
 +    b = myext_get_b(TSRMLS_C);​
 +    long sum = a+b;
 +    return sum;
 +  }
 +  ​
 +This function might be written like this:
 +
 +  static long myext_do_something() {
 +    long a, b;
 +    long sum;
 +    TSRMLS_FETCH();​
 +    ​
 +    a = myext_get_a();​
 +    b = myext_get_b(TSRMLS_C);​
 +    sum = a+b;
 +    ​
 +    return sum;
 +  }
  
 ====== Don't use zend_error ====== ====== Don't use zend_error ======
Line 89: Line 137:
     NULL,     NULL,
     PHP_MINFO(myext),​     PHP_MINFO(myext),​
-    ​MYEXT_VERSION,+    ​PHP_MYEXT_VERSION,
     STANDARD_MODULE_PROPERTIES     STANDARD_MODULE_PROPERTIES
   };   };
Line 96: Line 144:
  
 Also see the previous item. Also see the previous item.
 +
 +====== PECL site conformity ======
 +
 +A few conformity checks are done on the tarball upload, the PECL site will check for
 +
 +. presence of LICENSE or COPYING in the package.xml,​ add it to the root dir with the line like this
 +  ​
 +  <file name="​LICENSE"​ role="​doc"​ />
 +
 +. for version string compliance in package.xml and the extension source code. The following should be defined in one of the extension header files
 +
 +  #define PHP_EXTNAME_VERSION "​1.2.3"​
 +
 +This macros has to be used within your extname_module_entry to indicate the extension version. The version string in both package.xml and the defined macros have to match. The work of adding that macros could be already done when using ext_skel on PHP versions as of 5.4.21 or 5.5.5.
internals/review_comments.txt · Last modified: 2014/01/25 00:11 by sixd