File: CodingStyle

package info (click to toggle)
apcupsd 3.10.17-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 16,616 kB
  • ctags: 6,941
  • sloc: ansic: 42,075; sh: 7,896; cpp: 3,561; makefile: 2,001; perl: 1,469; tcl: 368; sed: 93
file content (34 lines) | stat: -rw-r--r-- 1,074 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Okay let's start to put something on paper.

I prefer:

type function(type arg1, type arg2,...) {
}

because is more readable to me.

Local and global variable are all lowercase and with a meaningful name.
Functions and globans not exported to other modules are `static'.
Function names are meaningful.
Indentation is (pick one):
	a) a TAB
	b) 4 chars
	c) 3 chars

Data structures are all in apc_struct.h
Defines are all uppercase and with meaningful name.
Defines are all in apc_defines.h
Externs are all in apc_externs.h
Flow control is indented like the function example above.
Comments are not only welcome: piece of code that may resemble like black
magic _must_ be well commented.
Diffs are to be submitted as `diff -u -r --new-file <old-tree> <new-tree>'
Configure is your friend: learn how to add modules to Makefile.in and tests to
configure.in
Try to keep logical position of files: docs in doc/, config files in etc/,
include files in include/ sources in ./, distribution specific files in
distributions/<whatever>.

Nothing more come to my mind right now.

- RF