rewrite the style guide

This commit is contained in:
2025-08-12 12:38:34 +02:00
parent 2e7932a70c
commit ebd5b6b430

View File

@@ -20,13 +20,14 @@ Where we have dependencies on:
| [openGL](https://www.opengl.org/) | hardware accelleration, for handling graphics. | | [openGL](https://www.opengl.org/) | hardware accelleration, for handling graphics. |
It is intended to be platform-agnostic, within reason. But the main focus is for [UNIX](https://unix.org/)-based systems with [x86_64](https://en.wikipedia.org/wiki/X86-64) architecture. It is intended to be platform-agnostic, within reason. But the main focus is for [UNIX](https://unix.org/)-based systems with [x86_64](https://en.wikipedia.org/wiki/X86-64) architecture.
Within [intdef.h](/src/util/intdef.h) there live definitions for static-width integer types. Within [intdef.h](/src/util/intdef.h) there live definitions for fixed-width integer types.
### style guide ### style guide
- Code must be written correctly, read [Correct C](./correct-c.md) if more information is required. - Code must be written correctly, read [Correct C](./correct-c.md) if more information is required.
- K&R style braces/[indentation](https://en.wikipedia.org/wiki/Indentation_style) - `snake_casing` is used, with no [Hungarian notation](https://en.m.wikipedia.org/wiki/Hungarian_notation). (macros are all-uppercase, with a few exceptions)
- typedefs are discouraged - [K&R style braces/indentation](https://en.wikipedia.org/wiki/Indentation_style) should be used.
- snake_case is used for all user-defined symbols. Macros are often all-uppercase, same goes for enums and other types of compile-time constants. - For indentation tabs are used, and are assumed to be 8 spaces wide. For alignment spaces should be used.
- tabs are used for indentation, spaces are used for alignment. - A space should precede a pointer `*`. Where it is attached to the name, rather than the type. For `const` clarity, and chains such as: `u8 *a, *b, *c;`. This is true for functions as well: `void *malloc(size_t n);`
- British spelling is (generally) preferred, but not enforced. - Generally speaking, British spelling is preferred. Define potential macros for, or when using alternate dialects.
- commits should attempt to convey clearly what is being changed, for the sanity of the maintainer(s). - Grammar should be correct. (`don't` or `do not`, not `dont`)
- Commits should attempt to convey clearly what is being changed, for the sanity of the maintainer(s).