Coding style in markdown.
This commit is contained in:
parent
d34e5a60d4
commit
97f101acb6
|
|
@ -1,5 +1,3 @@
|
|||
$Id$
|
||||
|
||||
vim: spelllang=en tw=78
|
||||
|
||||
This is a short introduction to the coding style that shall be used. The below
|
||||
|
|
@ -7,11 +5,11 @@ rules are applicable for all C source files, except the Ethernet drivers, for
|
|||
which the Linux Kernel coding style shall be used to minimize the
|
||||
differences).
|
||||
|
||||
1) Line length
|
||||
# Line length
|
||||
|
||||
- Lines shall not exceed 78 characters.
|
||||
|
||||
2) Whitespace
|
||||
# Whitespace
|
||||
|
||||
- Indentation shall be done using 4 space characters
|
||||
|
||||
|
|
@ -20,36 +18,39 @@ differences).
|
|||
- After commas, colons and semicolons, a single space shall be
|
||||
placed (if not followed by a line break).
|
||||
|
||||
- Binary operators (=, ==, ~=, |, ||, etc.) shall be enclosed by 2 spaces
|
||||
(except . and ->).
|
||||
- Binary operators (`=`, `==`, `~=`, `|`, `||`, etc.) shall be enclosed by 2 spaces
|
||||
(except `.` and `->`).
|
||||
|
||||
3) Placing braces
|
||||
# Placing braces
|
||||
|
||||
- Braces shall be placed in the following way (K&R style):
|
||||
|
||||
if (...) {
|
||||
...
|
||||
} else if (...) {
|
||||
...
|
||||
} else {
|
||||
...
|
||||
}
|
||||
```c
|
||||
if (...) {
|
||||
...
|
||||
} else if (...) {
|
||||
...
|
||||
} else {
|
||||
...
|
||||
}
|
||||
|
||||
int function(...)
|
||||
{
|
||||
...
|
||||
}
|
||||
int function(...)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
4) Defines and Macros
|
||||
# Defines and Macros
|
||||
|
||||
- Defines and macros shall be named in CAPITAL letters. If a macro contains
|
||||
multiple statements, they should be enclosed by a 'do {} while (0)' loop.
|
||||
Macro parameters shall also be capital letters and shall be enclosed py
|
||||
parantheses if necessary.
|
||||
|
||||
#define MACRO(A, B) \
|
||||
do { \
|
||||
if ((A) == 1) { \
|
||||
statement(B); \
|
||||
```c
|
||||
#define MACRO(A, B) \
|
||||
do { \
|
||||
if ((A) == 1) { \
|
||||
statement(B); \
|
||||
} while (0)
|
||||
|
||||
```
|
||||
26
README.md
26
README.md
|
|
@ -3,12 +3,12 @@ This is the README file of the IgH EtherCAT Master.
|
|||
vim: spelllang=en spell tw=78
|
||||
|
||||
Contents:
|
||||
- general-information
|
||||
- requirements
|
||||
- building-and-installing
|
||||
- realtime-and-tuning
|
||||
- license
|
||||
- coding-style
|
||||
- (#general-information)
|
||||
- (#requirements)
|
||||
- (#building-and-installing)
|
||||
- (#realtime-and-tuning)
|
||||
- (#license)
|
||||
- (#coding-style)
|
||||
|
||||
# General Information
|
||||
|
||||
|
|
@ -19,11 +19,13 @@ information, see http://etherlab.org/en/ethercat.
|
|||
|
||||
or contact
|
||||
|
||||
> Dipl.-Ing. (FH) Florian Pose <fp@igh.de>
|
||||
> Ingenieurgemeinschaft IgH
|
||||
> Nordsternstraße 66
|
||||
> D-45329 Essen
|
||||
> http://igh.de
|
||||
>>>
|
||||
Dipl.-Ing. (FH) Florian Pose <fp@igh.de>
|
||||
Ingenieurgemeinschaft IgH
|
||||
Nordsternstraße 66
|
||||
D-45329 Essen
|
||||
http://igh.de
|
||||
>>>
|
||||
|
||||
# Documentation
|
||||
|
||||
|
|
@ -108,4 +110,4 @@ property and similar rights of Beckhoff Automation GmbH.
|
|||
# Coding Style
|
||||
|
||||
Developers shall use the coding style rules in the [coding style
|
||||
file](CodingStyle.txt).
|
||||
file](CodingStyle.md).
|
||||
|
|
|
|||
Loading…
Reference in New Issue