File: CodingStyle

package info (click to toggle)
ltsp 5.18.12-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,016 kB
  • sloc: sh: 4,831; ansic: 1,590; perl: 280; python: 197; makefile: 173; lex: 152; yacc: 59
file content (23 lines) | stat: -rw-r--r-- 979 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
After a quick discussion on coding styles, here's what we've currently got
for consensus:

For shell scripts:

 - Shell scripts should be fully posix compliant.
 - We will favour the use of if [ ]; then else fi, over && and ||, for clarity
 - When using a multi check if, exception will be using the
   if [ .. ] && [ .. ] || [ .. ] form, as opposed to [ .. -a .. -o .. ] form.
 - If a single line test is used, use test <conditional> &&/|| result, and only
   for tests that fit on a single line.
 - We'll use spaces instead of tabs, and the indentation level will be 4
   spaces, the same as python.

For C programs:
 - Programs should be passed through the "indent" program periodically to clean
   them up.
 - The following indent command line should be used:
   indent -kr -i4 -nut -c50 -psl
     - K&R style (Scott's a greybeard)
     - 4 character tab width, and spaces instead of tabs
     - Align inline comments on column 50
     - A newline after function definitions