version 1.1.1.2, 2013/07/22 01:31:35
|
version 1.1.1.3, 2014/06/15 20:03:39
|
Line 59 Exceptions:
|
Line 59 Exceptions:
|
you're calling. |
you're calling. |
|
|
7. When commenting out code using a #if statement, do NOT use 0 only. Instead |
7. When commenting out code using a #if statement, do NOT use 0 only. Instead |
use "<svn username here>_0". For example, #if FOO_0, where FOO is your | use "<git username here>_0". For example, #if FOO_0, where FOO is your |
svn user foo. This allows easier tracking of why code was commented out, | git user foo. This allows easier tracking of why code was commented out, |
especially in bundled libraries. |
especially in bundled libraries. |
|
|
8. Do not define functions that are not available. For instance, if a |
8. Do not define functions that are not available. For instance, if a |
Line 82 Exceptions:
|
Line 82 Exceptions:
|
library may need to control or free the memory, or when the memory in |
library may need to control or free the memory, or when the memory in |
question needs to survive between multiple requests. |
question needs to survive between multiple requests. |
|
|
Naming Conventions | User Functions/Methods Naming Conventions |
------------------ |
------------------ |
|
|
1. Function names for user-level functions should be enclosed with in |
1. Function names for user-level functions should be enclosed with in |
Line 151 Naming Conventions
|
Line 151 Naming Conventions
|
|
|
7. Classes should be given descriptive names. Avoid using abbreviations where |
7. Classes should be given descriptive names. Avoid using abbreviations where |
possible. Each word in the class name should start with a capital letter, |
possible. Each word in the class name should start with a capital letter, |
without underscore delimiters (CampelCaps starting with a capital letter). | without underscore delimiters (CamelCaps starting with a capital letter). |
The class name should be prefixed with the name of the 'parent set' (e.g. |
The class name should be prefixed with the name of the 'parent set' (e.g. |
the name of the extension):: |
the name of the extension):: |
|
|
Line 163 Naming Conventions
|
Line 163 Naming Conventions
|
'foobar' |
'foobar' |
'foo_bar' |
'foo_bar' |
|
|
|
Internal Function Naming Convensions |
|
---------------------- |
|
|
|
1. Functions that are part of the external API should be named |
|
'php_modulename_function()' to avoid symbol collision. They should be in |
|
lowercase, with words underscore delimited. Exposed API must be defined |
|
in 'php_modulename.h'. |
|
|
|
PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS); |
|
|
|
Unexposed module function should be static and should not be defined in |
|
'php_modulename.h'. |
|
|
|
static int php_session_destroy(TSRMLS_D) |
|
|
|
2. Main module source file must be named 'modulename.c'. |
|
|
|
3. Header file that is used by other sources must be named 'php_modulename.h'. |
|
|
|
|
Syntax and indentation |
Syntax and indentation |
---------------------- |
---------------------- |
|
|
Line 181 Syntax and indentation
|
Line 201 Syntax and indentation
|
of PHP or one of its standard modules, please maintain the K&R |
of PHP or one of its standard modules, please maintain the K&R |
style. This applies to just about everything, starting with |
style. This applies to just about everything, starting with |
indentation and comment styles and up to function declaration |
indentation and comment styles and up to function declaration |
syntax. Also see Indentstyle_. | syntax. Also see Indentstyle. |
|
|
.. _Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html | Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html |
|
|
3. Be generous with whitespace and braces. Keep one empty line between the |
3. Be generous with whitespace and braces. Keep one empty line between the |
variable declaration section and the statements in a block, as well as |
variable declaration section and the statements in a block, as well as |