Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:manual:contrib:coding_style_guidelines [2020/03/10 23:28] emulatorman |
en:manual:contrib:coding_style_guidelines [2022/03/28 17:27] (current) i3_relativism ↷ Page moved from en:contrib:coding_style_guidelines to en:manual:contrib:coding_style_guidelines |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== HyperbolaBSD™ Coding Style Guidelines ====== | + | ====== HyperbolaBSD Coding Style Guidelines ====== |
===== Description ===== | ===== Description ===== | ||
- | This article specifies the preferred style for kernel source files in the <color # | + | This article specifies the preferred style for kernel source files in the <color # |
These guidelines should be followed for all new code. In general, code can be considered “new code” when it makes up about 50% or more of the file(s) involved. | These guidelines should be followed for all new code. In general, code can be considered “new code” when it makes up about 50% or more of the file(s) involved. | ||
<code c> | <code c> | ||
/* | /* | ||
- | * Style guide for the HyperbolaBSD™ KNF (Kernel Normal Form). | + | * Style guide for the HyperbolaBSD KNF (Kernel Normal Form). |
*/ | */ | ||
Line 108: | Line 108: | ||
When declaring variables in structures, declare them sorted by use, then by size (largest to smallest), then by alphabetical order. | When declaring variables in structures, declare them sorted by use, then by size (largest to smallest), then by alphabetical order. | ||
- | Major structures should be declared at the top of the file in which they are used, or in separate header files if they are used in multiple source files. | + | Major structures should be declared at the top of the file in which they are used, or in separate header files if they are used in multiple source files. |
<code c> | <code c> | ||
Line 123: | Line 123: | ||
<code c> | <code c> | ||
#include < | #include < | ||
- | struct | + | struct foo { |
LIST_ENTRY(foo) link; /* Queue macro glue for foo lists */ | LIST_ENTRY(foo) link; /* Queue macro glue for foo lists */ | ||
struct | struct | ||
Line 394: | Line 394: | ||
===== History ===== | ===== History ===== | ||
- | This article is largely based on the <color # | + | This article is largely based on the <color # |
===== Licensing ===== | ===== Licensing ===== | ||
- | This wiki article is released under the [[https:// | + | This wiki article is released under the [[https:// |
===== Acknowledgement ===== | ===== Acknowledgement ===== | ||
- | This wiki article is based on **[[https:// | + | This wiki article is based on **4.4BSD-Lite2 |