1 Star 0 Fork 6

itisic/EtherCAT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CodingStyle.txt 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
zhanglin 提交于 2022-11-30 07:13 . Get from EtherCAT stable-1.5
$Id$
vim: spelllang=en tw=78
This is a short introduction to the coding style that shall be used. The below
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
- Lines shall not exceed 78 characters.
2) Whitespace
- Indentation shall be done using 4 space characters
- No whitespace shall be left at the end of a line.
- 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 ->).
3) Placing braces
- Braces shall be placed in the following way (K&R style):
if (...) {
...
} else if (...) {
...
} else {
...
}
int function(...)
{
...
}
4) 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); \
} while (0)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/itisic/ether-cat.git
git@gitee.com:itisic/ether-cat.git
itisic
ether-cat
EtherCAT
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385