User Tools

Site Tools


iotivity_c_coding_standards

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
iotivity_c_coding_standards [2015/02/23 23:24]
Jon A. Cruz Fix beginning of the document where '++' started being treated as a wiki formatting string
iotivity_c_coding_standards [2015/03/18 23:12] (current)
Ossama Othman [General Standards] Point out intptr_t and uintptr_t in integer/pointer cast discussion.
Line 13: Line 13:
   * Avoid lengthy functions. Break up functions into smaller functional units where possible unless constructing a deeply nested loop which must run under severe time constraints (e.g. in a 3D rendering or 2D filtering scenario). ​ [C/C%%++%%]   * Avoid lengthy functions. Break up functions into smaller functional units where possible unless constructing a deeply nested loop which must run under severe time constraints (e.g. in a 3D rendering or 2D filtering scenario). ​ [C/C%%++%%]
   * Preprocessor directives should begin on the first column of the line unless they are being explicitly nested. ​ [C/C%%++%%]   * Preprocessor directives should begin on the first column of the line unless they are being explicitly nested. ​ [C/C%%++%%]
-  * Pointers must not be cast directly to integers except where forced by an API function. In general an integer the size of a pointer can be made available and may be used when absolutely necessary. ​ If you choose to cast pointers to ''​int''​ and ''​int''​s to pointers provide a comment with the reason. ​ [C/C%%++%%]+  * Pointers must not be cast directly to integers except where forced by an API function. In general an integer the size of a pointer ​(e.g. ''​intptr_t''​ or ''​uintptr_t''​) ​can be made available and may be used when absolutely necessary. ​ If you choose to cast pointers to ''​int''​ and ''​int''​s to pointers provide a comment with the reason. ​ [C/C%%++%%]
   * Initialize all variables before they are used. When initializing C-style structures, prefer<​code cpp>   * Initialize all variables before they are used. When initializing C-style structures, prefer<​code cpp>
 Type var = {0}; Type var = {0};
iotivity_c_coding_standards.txt ยท Last modified: 2015/03/18 23:12 by Ossama Othman