Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:manual:contrib:coding_style_guidelines [2020/03/10 23:37]
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 108: Line 108:
 When declaring variables in structures, declare them sorted by use, then by size (largest to smallest), then by alphabetical order.  The first category normally doesn't apply, but there are exceptions.  Each one gets its own line.  Put a tab after the first word, i.e., use ‘<color #620BB9/#EEDDFF>int^Ix;</color>’ and ‘<color #620BB9/#EEDDFF>struct^Ifoo *x;</color>’. When declaring variables in structures, declare them sorted by use, then by size (largest to smallest), then by alphabetical order.  The first category normally doesn't apply, but there are exceptions.  Each one gets its own line.  Put a tab after the first word, i.e., use ‘<color #620BB9/#EEDDFF>int^Ix;</color>’ and ‘<color #620BB9/#EEDDFF>struct^Ifoo *x;</color>’.
  
-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.  Use of the structures should be by separate declarations and should be “<color #620BB9/#EEDDFF>extern</color>” if they are declared in a header file.+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.  Use of the structures should be separated by declarations and should be “<color #620BB9/#EEDDFF>extern</color>” if they are declared in a header file.
  
 <code c> <code c>
Line 123: Line 123:
 <code c> <code c>
 #include <sys/queue.h> #include <sys/queue.h>
-struct  foo {+struct foo {
         LIST_ENTRY(foo) link;   /* Queue macro glue for foo lists */         LIST_ENTRY(foo) link;   /* Queue macro glue for foo lists */
         struct  mumble amumble; /* Comment for mumble */         struct  mumble amumble; /* Comment for mumble */
Line 394: Line 394:
 ===== History ===== ===== History =====
  
-This article is largely based on the <color #0B71B9/#DDF1FF>src/admin/style/style</color> file from the <color #B90B0B/#FFDDDD>4.4BSD-Lite2</color> release, with updates to reflect the current practice and desire of the <color #0BB928/#DDFFE3>HyperbolaBSD</color> development.+This article is largely based on the <color #0B71B9/#DDF1FF>src/admin/style/style</color> file from the <color #B90B0B/#FFDDDD>4.4BSD-Lite2</color> release, with updates from the <color #B90B0B/#FFDDDD>OpenBSD</color> project to reflect the current practice and desire of the <color #0BB928/#DDFFE3>HyperbolaBSD</color> development.
  
 ===== Licensing ===== ===== Licensing =====
Line 402: Line 402:
 ===== Acknowledgement ===== ===== Acknowledgement =====
  
-This wiki article is based on **[[https://man.openbsd.org/|OpenBSD Manual Page]]**.+This wiki article is based on **4.4BSD-Lite2 Manual Page**.