Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09677e0f authored by Pavel Kretov's avatar Pavel Kretov Committed by Jonathan Corbet
Browse files

Documentation/CodingStyle: improve text layout



Try to make coding style documentation look a bit more readable and
consistent with the following:

 - indent every code example in C to first tab-stop;
 - surround every code example with empty lines, both top and bottom;
 - remove empty lines where text looked way too spare;
 - do not indent examples in elisp and kconfig;
 - do not do any non-whitespace changes.

Signed-off-by: default avatarPavel Kretov <firegurafiku@gmail.com>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 696156f0
Loading
Loading
Loading
Loading
+72 −69
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ instead of "double-indenting" the "case" labels. E.g.:
		break;
	}


Don't put multiple statements on a single line unless you have
something to hide:

@@ -186,8 +185,11 @@ although they are not required in the language, as in: "sizeof info" after
"struct fileinfo info;" is declared).

So use a space after these keywords:

	if, switch, case, for, do, while

but not with sizeof, typeof, alignof, or __attribute__.  E.g.,

	s = sizeof(struct file);

Do not add spaces around (inside) parenthesized expressions.  This example is
@@ -209,12 +211,15 @@ such as any of these:
	=  +  -  <  >  *  /  %  |  &  ^  <=  >=  ==  !=  ?  :

but no space after unary operators:

	&  *  +  -  ~  !  sizeof  typeof  alignof  __attribute__  defined

no space before the postfix increment & decrement unary operators:

	++  --

no space after the prefix increment & decrement unary operators:

	++  --

and no space around the '.' and "->" structure member operators.
@@ -268,13 +273,11 @@ See chapter 6 (Functions).
		Chapter 5: Typedefs

Please don't use things like "vps_t".

It's a _mistake_ to use typedef for structures and pointers. When you see a

	vps_t a;

in the source, what does it mean?

In contrast, if it says

	struct virtual_container *a;