CODECONVENTIONS.md: Add function/variable/argument naming convention

pull/1344/merge
stijn 2015-06-24 11:52:51 +02:00 zatwierdzone przez Damien George
rodzic d02f671737
commit 9c7d183a94
1 zmienionych plików z 9 dodań i 6 usunięć

Wyświetl plik

@ -36,6 +36,9 @@ 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:
- Use underscore_case, not camelCase for all names.
Type names and declarations: Type names and declarations:
- When defining a type, put '_t' after it. - When defining a type, put '_t' after it.
@ -53,16 +56,16 @@ general guidelines are:
Examples Examples
-------- --------
Braces and spaces: Braces, spaces and names:
int foo(int x, int y) { int foo_function(int x, int some_value) {
if (x < y) { if (x < some_value) {
foo(y, x); foo(some_value, x);
} else { } else {
foo(x + 1, y - 1); foo(x + 1, some_value - 1);
} }
for (int i = 0; i < x; i++) { for (int my_counter = 0; my_counter < x; my_counter++) {
} }
} }