|
|
@ -15,7 +15,7 @@ Some code conventions are checked by the ``make codepolicycheck`` target. |
|
|
|
Basic conventions |
|
|
|
================= |
|
|
|
|
|
|
|
Indentantion, naming, etc |
|
|
|
Indentation, naming, etc. |
|
|
|
------------------------- |
|
|
|
|
|
|
|
Indent with tab. On continuation lines indent with tab to shared indent |
|
|
@ -33,7 +33,7 @@ Names are lowercase, underscore separated:: |
|
|
|
/* ... */ |
|
|
|
} |
|
|
|
|
|
|
|
Local functions, arrays, structs, typedefs, etc have a double underscore |
|
|
|
Local functions, arrays, structs, typedefs, etc. have a double underscore |
|
|
|
after "duk":: |
|
|
|
|
|
|
|
typedef int duk__temptype; |
|
|
@ -60,7 +60,7 @@ interest only can have a local name or have a double underscore after "DUK":: |
|
|
|
/* select DUK_FOO provider */ |
|
|
|
#define DUK_FOO DUK_FOO_ALT2 |
|
|
|
|
|
|
|
There is only one space after a ``#define``, ``#if``, etc, but there may be |
|
|
|
There is only one space after a ``#define``, ``#if``, etc., but there may be |
|
|
|
multiple spaces between the a macro name and its definition. There is no |
|
|
|
strict rule on the alignment of a macro value; successive definitions usually |
|
|
|
keep values in the same column. |
|
|
@ -171,7 +171,7 @@ Comment styles |
|
|
|
-------------- |
|
|
|
|
|
|
|
A block or "banner" comment is used in file headers and to distinguish logical |
|
|
|
sections containing (typically) multiple functions, definitions, variables, etc:: |
|
|
|
sections containing (typically) multiple functions, definitions, variables, etc.:: |
|
|
|
|
|
|
|
/* |
|
|
|
* First line is empty and there are two spaces between the star |
|
|
@ -220,7 +220,7 @@ ending period (i.e. the text is not a sentence):: |
|
|
|
} |
|
|
|
|
|
|
|
A comment on the same line as a statement is separate by two spaces. Don't |
|
|
|
use C++ style comments as they're not portable:: |
|
|
|
use C++ style comments, as they're not portable:: |
|
|
|
|
|
|
|
static void duk__helper(char *values, int count) { |
|
|
|
int i; /* loop counter */ |
|
|
@ -765,7 +765,7 @@ There are several issues related to symbol visibility: |
|
|
|
* Minimality: Duktape should only expose the function and data symbols that |
|
|
|
are used by calling programs. This is a hygiene issue but also affects |
|
|
|
compiler optimization: if a function is internal, it doesn't need to conform |
|
|
|
to a rigid ABI which allows some optimizations. See e.g. |
|
|
|
to a rigid ABI, which allows some optimizations. See e.g. |
|
|
|
https://gcc.gnu.org/wiki/Visibility. |
|
|
|
|
|
|
|
* Single file vs. separate files: symbols need to be declared differently |
|
|
@ -872,7 +872,7 @@ MSVC DLL import/export |
|
|
|
---------------------- |
|
|
|
|
|
|
|
For MSVC, DLL import/export attributes are needed to build as a DLL. |
|
|
|
When compiling Duktape public symbols should be declared as "dllexport" |
|
|
|
When compiling Duktape, public symbols should be declared as "dllexport" |
|
|
|
in both header files and the actual declarations. When compiling a |
|
|
|
user application, the same header symbols must be declared as "dllimport". |
|
|
|
The compilation context is available through ``DUK_COMPILING_DUKTAPE``. |
|
|
|