|
|
@ -9,7 +9,8 @@ your plans.
|
|
|
|
|
|
|
|
|
|
|
|
Sway is written in C. The style guidelines is [kernel
|
|
|
|
Sway is written in C. The style guidelines is [kernel
|
|
|
|
style](https://www.kernel.org/doc/Documentation/CodingStyle), but all braces go
|
|
|
|
style](https://www.kernel.org/doc/Documentation/CodingStyle), but all braces go
|
|
|
|
on the same line (*"but K&R!" is silly*). Some points to note:
|
|
|
|
on the same line (*"but K&R says so!" is a silly to justify something*). Some
|
|
|
|
|
|
|
|
points to note:
|
|
|
|
|
|
|
|
|
|
|
|
* Do not use typedefs unless you have a good reason
|
|
|
|
* Do not use typedefs unless you have a good reason
|
|
|
|
* Do not use macros unless you have a *really* good reason
|
|
|
|
* Do not use macros unless you have a *really* good reason
|
|
|
@ -19,6 +20,8 @@ on the same line (*"but K&R!" is silly*). Some points to note:
|
|
|
|
* Use logging with reckless abandon
|
|
|
|
* Use logging with reckless abandon
|
|
|
|
* Always include braces for if/for/while/etc, even for one-liners
|
|
|
|
* Always include braces for if/for/while/etc, even for one-liners
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
An example of well formatted code:
|
|
|
|
|
|
|
|
|
|
|
|
```C
|
|
|
|
```C
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|