User Tools

Site Tools


design:coding_style_guide

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
design:coding_style_guide [2025/05/04 18:24] asiedesign:coding_style_guide [2025/05/05 15:17] (current) – [Commenting] asie
Line 31: Line 31:
 ===== Code style ===== ===== Code style =====
  
- * Braces are always on the same line, and are separated with a space. +  * Braces are always on the same line, and are separated with a space. 
- * If it doesn't otherwise hurt readability, using no braces for a single-line statement is fine.+  * If it doesn't otherwise hurt readability, using no braces for a single-line statement is fine.
  
 <code c> <code c>
Line 46: Line 46:
 </code> </code>
  
- * Pointers are declared with the asterisk ''*'' adjacent to the type name. ''const'' goes before the type name.+  * Pointers are declared with the asterisk ''*'' adjacent to the type name. ''const'' goes before the type name.
  
 <code c> <code c>
Line 52: Line 52:
 </code> </code>
  
-===== Commenting =====+===== Documentation =====
  
 Use [[https://www.doxygen.nl/manual/docblocks.html|Doxygen-compatible]] formatting for all user-facing documentation comments: Use [[https://www.doxygen.nl/manual/docblocks.html|Doxygen-compatible]] formatting for all user-facing documentation comments:
Line 58: Line 58:
   * Javadoc-style ''%%/** .. */%%'' blocks for documenting functions, types, macros and/or where larger comment blocks are warranted;   * Javadoc-style ''%%/** .. */%%'' blocks for documenting functions, types, macros and/or where larger comment blocks are warranted;
   * For one-line comments, such as on enumerated types, ''%%///<%%'' can be used.   * For one-line comments, such as on enumerated types, ''%%///<%%'' can be used.
 +  * When writing internal header macros/functions that are not meant for the library user, put such code between ''%%/// @cond INTERNAL%%'' and ''%%/// @endcond%%'' blocks.
 ===== Best practices ===== ===== Best practices =====
  
design/coding_style_guide.1746383065.txt.gz · Last modified: 2025/05/04 18:24 by asie