Added some text to the coding standard about variable names.
This commit is contained in:
@@ -9,6 +9,19 @@ to the code regardless of the authors preferred style. You may certainly
|
|||||||
adjust the code to your preferred style using an indent tool. We use the
|
adjust the code to your preferred style using an indent tool. We use the
|
||||||
script indent.sh to adjust all the .c and .h files.
|
script indent.sh to adjust all the .c and .h files.
|
||||||
|
|
||||||
|
For variable names, separate words within the variables by underscores.
|
||||||
|
Do not use capital letters as separators. Consider how much harder
|
||||||
|
IcantReadThis is on the eyes versus I_can_read_this.
|
||||||
|
|
||||||
|
Variable and function names are defined with the first words being
|
||||||
|
descriptive of broad ideas, and later words narrowing down to specifics.
|
||||||
|
For instance: Universe_Galaxy_System_Planet. Consider the following names:
|
||||||
|
Timer_0_Data, Timer_0_Overflow, and Timer_0_Capture. This convention
|
||||||
|
quickly narrows variables to particular segments of the program.
|
||||||
|
Never assume that a verb must be first, as often seen when naming functions.
|
||||||
|
Open_Serial_Port and Close_Serial_Port do a much poorer job of grouping
|
||||||
|
than the better alternative of Serial_Port_Open and Serial_Port_Close.
|
||||||
|
|
||||||
Don't use C++-style comments (comments beginning with "//" and running
|
Don't use C++-style comments (comments beginning with "//" and running
|
||||||
to the end of the line) for modules that are written in C. The module
|
to the end of the line) for modules that are written in C. The module
|
||||||
may run through C rather than C++ compilers, and not all C compilers
|
may run through C rather than C++ compilers, and not all C compilers
|
||||||
|
|||||||
Reference in New Issue
Block a user