Standards
From Caos Linux Wiki
(Redirected from Standard)
Comments
Always comment your code !
This is the format that you want to use for a single line comment:
/** This is the comment **/
This is the format that you want to use for a multiple line comment:
/* * This is a multiple * line comment. */
Indentions
Always use tabs instead of spaces.
Functions
void example_function(param1, param2)
{
<tab>this;
}
Conditions and Loops
if (this) {
<tab>do that;
}
while (this) {
<tab>do that;
}
Variables
Global Variables need to start with a capital letter.
Each function argument (except for argc, argv, env) needs to preferably start with "_".
Custom Types
Enumerations
Enumeration names need to be completely writtin in lowercase letters.
Enumeration contents need to be lowercase as well.
Brackets must coorespond
Every Element needs to be on a sperate row.
enum fruit
{
<tab>orange,
<tab>banana,
<tab>mango,
}
Structures
structure fruit
{
<tab>char *name;
<tab>int price;
<tab> void fruit_next
};
Headers
header.h void printf(char *_str); int add(int _a; int _b);
