Download C Program Style Guidelines
Transcript
Table of Contents 1. Introduction ..........................................................................................................1 1.1. General Philosophy ........................................................................................................... 1 2. C/C++ Elements .....................................................................................................2 2.1. Header files ........................................................................................................................2 2.1.1. Separate header files for separate devices ..................................................................2 2.1.2. Include header files once .............................................................................................2 2.2. Naming conventions .........................................................................................................3 2.2.1. Function and variable names should convey their purpose.......................................3 2.2.2. Format multi‐word names consistently .....................................................................4 2.3. Symbolic constants and macros .......................................................................................5 2.3.1. Replace literal constants with symbolic constants....................................................5 2.3.2. Symbolic constant names .......................................................................................... 6 2.3.3. Do not put comments in macros ............................................................................... 6 3. Commenting Your Code.........................................................................................7 Doxygen command format ...............................................................................................7 File comments....................................................................................................................7 Macro and symbolic constant comments....................................................................... 8 Commenting functions .................................................................................................... 9 Commenting other elements.......................................................................................... 10 3.1. 3.2. 3.3. 3.4. 3.5. Bibliography...............................................................................................................11