Formatting Simple Declarations
- Last UpdatedJul 18, 2023
- 1 minute read
The following conventions should be observed when formatting simple Cicode declarations:
-
Only one item should be declared per declaration; there should be no comma separated list of variables.
-
Tab stops should be used for declarations and indentation.
For example:
INT hFile,hForm; // WRONG
INT hFile; // RIGHT
INT hForm; // RIGHT
The reasons for this are:
-
Only the first identifier in the WRONG case is obvious and the others are often missed in a quick glance;.
-
It is harder to add a comment or initialization to an item in the WRONG case.
-
Types, items, and initialization within a group of declarations should be vertically aligned.
For example:
STRING sFileName = "temp.dat"; // WRONG
INT iOffset = -1; // WRONG
INT iState = 3; // WRONG
STRING sFileName = "temp.dat"; // RIGHT
INT iOffset = -1; // RIGHT
INT iState = 3; // RIGHT
See Also
Using Cicode Commands