Coding standards
Formatting:
- Formatting your source code.
Keep the length of source lines to 79 characters or less, for maximum readability in the widest range of environments.
It is important to put the open-brace that starts the body of a C function in column one, so that they will start a defun. Several tools look for open-braces in column one to find the beginnings of C functions. These tools will not work on code not formatted that way.
Avoid putting open-brace, open-parenthesis or open-bracket in column one when they are inside a function, so that they won’t start a defun. The open-brace that starts a struct body can go in column one if you find it useful to treat that definition as a defun.
It is also important for function definitions to start the name of the function in column one. This helps people to search for function definitions, and may also help certain tools recognize them. Thus, using Standard C syntax, the format is this
For more details : https://www.gnu.org/prep/standards/html_node/Formatting.html#Formatting
Comments
- Commenting your work.
- Syntactic Conventions: Clean use of C constructs.
- Names: Naming variables, functions, and files.
- System Portability: Portability among different operating systems.
- CPU Portability: Supporting the range of CPU types.
- System Functions: Portability and “standard” library functions.