Formatting Expressions
The following conventions should be observed when formatting Cicode functions:
- When an expression forms a complete statement, it should, like any other statement, occupy one or more lines of its own and be indented to the current level. Operators should be surrounded by spaces. For example:
i= i*10+c-'0'; // WRONG
i = i * 10 + c - '0'; // RIGHT
- When a sub-expression is enclosed in brackets, the first symbol of the sub-expression should be placed hard against the opening bracket. The closing bracket should be placed immediately after the last character for the sub-expression. For example:
a = b * ( c - d ); // WRONG
a = b * (c - d); // RIGHT
- The round brackets which surround the arguments of a function attract no spaces, for example:
DisplayText( "hello" ); // WRONG
DisplayText("hello"); // RIGHT
- Commas, whether used as operators or separators, would be placed hard against the previous symbol and followed by a space. For example:
DevSeek(hDev ,Offset); // WRONG
DevSeek(hDev, Offset); // RIGHT
See Also
Published June 2018