-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Matthieu Basset edited this page Mar 18, 2023
·
17 revisions
Welcome to the when-the-factory wiki!
(Open to discuss)
/* Constants in SCREAMING_SNAKE_CASE
* as well as enum members */
#define NICE_CONSTANT
/*This is the style used for enums, skip line if there is a member counter */
enum Types {
TYPE_1,
TYPE_2,
TYPE_3,
TYPE_NUM,
};
/* "Usual" variables in snake_case */
int some_variable = 0;
/* Special case for gloal variable indexed by "g_" */
SomeType g_global_variable;
/* Custom structs and enums are in PascalCase */
struct CustomType {
int x, y;
};
typedef struct CustomType CustomType;Usually we define these variables in a relevant source file and refer to them with the extern keyword in the corresponding header file.
/* This type of comments are used
* with this style for multiline comment */
// Double slash comments aren't usedFunction documentation convention hasn't been clearly established yet.
The star is on the left
/* Good */
int* h;
/* Bad */
int * g;
int *gg;Tabs are used for indentation in every file.
Opening brackets are on the same line as what they are inked to. Spaces are often left before parentheses and brackets.
for (int i = 0; i < 100; ++i) {
while (i < value) {
/* Code */
}
} The maximal length for a line of code should be 100 characters.
Header files includes are always grouped by categories, these categories being
- Standard headers
- Third-party headers
- Local headers
There is no specific order among these categories. Nor there is obligation to separate these categories by empty lines