-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSTYLE.txt
89 lines (86 loc) · 1.81 KB
/
STYLE.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/************************* libvmcu - Coding Style and Conventions *************************/
*
* Last update on: Feb 14 2021
*
* This document describes the coding style of libvmcu. This short guide will be updated
* regulary.
*
*
* [1] Indentation
*
* libvmcu's indentation is always 4 spaces. Do not use tab.
*
*
* [2] Namespace
*
* Every extern function should use the vmcu_ namespace, even if it's not exposed in the
* library interface. For example:
*
* extern void vmcu_function(int arg);
*
* Every static function must not use the vmcu_ namespace.
*
* Exception to this rule: Macros in arch/ and internal macros.
*
*
* [3] Braces
*
* Opening braces are placed in the same line of a statement/function/etc. For example:
*
* static void func(void) {
*
* // do something
* }
*
* [4] Spaces in between operands
*
* Spaces are placed in between operands in order to maximize readability. Example:
*
* if((x + 1) == NUMBER || (y + 1) == NUMBER)
*
*
* [5] Header Guards
*
* Internal header guards:
*
* #ifndef VMCU_FILENAME_H
* #define VMCU_FILENAME_H
*
* #endif
*
*
* Library interface header guards:
*
* #ifndef LIBVMCU_FILENAME_INTERFACE_H
* #define LIBVMCU_FILENAME_INTERFACE_H
*
* #endif
*
*
* [6] Filenames
*
* Internal filenames must not use the vmcu_ prefix. For example:
*
* filename.h instead of vmcu_filename.h
*
* For external interfaces:
*
* libvmcu_filename.h
*
* [7] Structures and their typedefs
*
* Structurenames (external, internal) are formed like this:
*
* typedef vmcu_structname {
*
* // declaration
*
* } vmcu_structname_t;
*
* Exception: If structname is way too long, a meaningful abbreviation can
* be used instead.
*
*
*
*
/******************************************************************************************/