Skip to content

Commit 658c226

Browse files
authored
Merge pull request contiki-ng#2808 from nvt/extend-code-style-doc
Extend code style document
2 parents c45e3b9 + 3922224 commit 658c226

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

doc/project/Code-style.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Code style
22

3+
The code style guidelines in this document apply to Contiki-NG source
4+
files written in the C programming language. Source files written in
5+
other programming languages should follow a common style convention if one
6+
exists; e.g., PEP 8 for Python. Moreover, if a specific code style is already
7+
commonly used for a given language in the repository, it is encouraged to
8+
follow this code style.
9+
10+
## Standard compliance
11+
12+
Contiki-NG programmers should adhere to the ISO/IEC 9899:2011 standard
13+
(also referred to as "C11") as much as possible. Observe that this guideline
14+
is currently limited to the subset of C11 supported by GCC 4.7 in order to
15+
ensure that MSP430-based platforms continue to work.
16+
17+
When writing architecture-specific source code for the native platform, one
18+
should also adhere to IEEE Std 1003.1-2017 (also referred to as "POSIX") when
19+
possible. For other architecture-specific source code, it is acceptable to
20+
rely on compiler extensions where this is necessary.
21+
322
## Naming
423

524
* File names are composed of lower-case characters and dashes. Like
@@ -90,7 +109,7 @@ Below is an example .c files that complies with the Contiki-NG code style:
90109
/* Single line comments look like this. */
91110

92111
/*
93-
* Multi-line comments look like this. Comments should prefferably be
112+
* Multi-line comments look like this. Comments should preferably be
94113
* full sentences, filled to look like real paragraphs.
95114
*/
96115

0 commit comments

Comments
 (0)