Appendix C. C Coding Standards

Table of Contents

C.1. General Guidelines
C.2. Code Layout
C.2.1. Application Code Layout
C.2.1.1. Standard File Sections
C.2.2. Library Code Layout
C.2.2.1. Library Header File
C.2.2.2. Library Source File
C.2.2.3. Standard File Sections
C.2.3. Ease of Reading
C.2.3.1. Line Length
C.2.3.2. Variable Names
C.2.3.3. Braces
C.2.3.4. Indentation
C.3. ANSI C Standard
C.4. Use of the Preprocessor
C.4.1. Constants
C.4.2. Macros
C.5. Comments
C.6. Variables
C.6.1. Global variables
C.6.2. Static Variables in Functions
C.6.3. Variable Declarations
C.6.4. Variable Initialisation
C.6.5. Use of int, ajint, long and ajlong
C.7. Precedence of Operators
C.8. Structures and Unions
C.8.1. Declaration
C.8.2. Naming Conventions
C.8.3. Datatype Documentation
C.9. Functions
C.9.1. Function Prototypes
C.9.2. Implicit Declarations
C.9.3. Function and Parameter Names
C.9.4. Function Layout
C.9.5. Function Documentation
C.10. Program Flow
C.10.1. Loops
C.10.2. goto
C.10.3. switch Statements
C.11. Memory Allocation
C.11.1. General Memory Management
C.11.2. Object Construction
C.11.3. Object Destruction