From a184cf93fc76a5c07665c3b1e617712a2f4f5df0 Mon Sep 17 00:00:00 2001 From: Quinn Date: Thu, 5 Jun 2025 16:06:21 +0200 Subject: [PATCH] start working on a style reference sheet --- docs/dev/styleref.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 docs/dev/styleref.md diff --git a/docs/dev/styleref.md b/docs/dev/styleref.md new file mode 100644 index 0000000..17b34a7 --- /dev/null +++ b/docs/dev/styleref.md @@ -0,0 +1,26 @@ +# mcaselector-lite style reference +## contents +- [recommended tool chains](#recommended-tool-chains) +- [style guide](#style-guide) + +### recommended tools +- gcc +- git (duh) +- clang-format +- clang-tidy +- linux / unix-like machine + +### style guide +- parameterless functions should have the `void` parameter.[^cstd] +- symbols mustn't be prefixed with `_`; this is a C standard reserved symbol.[^cstd] +- typedefs (or anything else for that matter) mustn't be suffixed with `_t`, this is reserved by POSIX.[^cstd] +- functions should do one thing, and do that thing well.[^cstd] +- K&R style braces/indentation[^wikiindent] +- typedefs are discouraged +- 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. +- tabs are used for indentation, spaces are used for alignment. +- British spelling is preferred, but not enforced. What is enforced is that British variants of the symbols are available. +- commits should attempt to convey clearly what is being changed, for the sanity of the maintainer(s). + +[cstd]: this is a general C practice, included since it is something commonly done incorrectly. +[wikiindent]: