CODECONVENTIONS.md: Mention macro and enum names.
This commit is contained in:
parent
9c7d183a94
commit
3299f687f5
@ -36,11 +36,10 @@ Header files:
|
|||||||
- Header files should be protected from multiple inclusion with #if
|
- Header files should be protected from multiple inclusion with #if
|
||||||
directives. See an existing header for naming convention.
|
directives. See an existing header for naming convention.
|
||||||
|
|
||||||
Function, variable and argument names:
|
Names:
|
||||||
- Use underscore_case, not camelCase for all names.
|
- Use underscore_case, not camelCase for all names.
|
||||||
|
- Use CAPS_WITH_UNDERSCORE for enums and macros.
|
||||||
Type names and declarations:
|
- When defining a type use underscore_case and put '_t' after it.
|
||||||
- When defining a type, put '_t' after it.
|
|
||||||
|
|
||||||
Integer types: Micro Python runs on 16, 32, and 64 bit machines, so it's
|
Integer types: Micro Python runs on 16, 32, and 64 bit machines, so it's
|
||||||
important to use the correctly-sized (and signed) integer types. The
|
important to use the correctly-sized (and signed) integer types. The
|
||||||
@ -58,11 +57,13 @@ Examples
|
|||||||
|
|
||||||
Braces, spaces and names:
|
Braces, spaces and names:
|
||||||
|
|
||||||
|
#define TO_ADD (123)
|
||||||
|
|
||||||
int foo_function(int x, int some_value) {
|
int foo_function(int x, int some_value) {
|
||||||
if (x < some_value) {
|
if (x < some_value) {
|
||||||
foo(some_value, x);
|
foo(some_value, x);
|
||||||
} else {
|
} else {
|
||||||
foo(x + 1, some_value - 1);
|
foo(x + TO_ADD, some_value - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int my_counter = 0; my_counter < x; my_counter++) {
|
for (int my_counter = 0; my_counter < x; my_counter++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user