1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-22 05:03:56 +03:00
kakoune/doc/coding-style.asciidoc
Coleman McFarland 2c1e238a0c
doc: declare C++20 as the language version
Technically we seem to be compiling with `-std=c++2a` which (if I
understand correctly) is "all the features we have from 23 and up.

But 20 is the earliest version that compiles for me (with clang). 14 and 17 didn't work.
2024-05-22 19:18:47 -04:00

50 lines
1.1 KiB
Plaintext

C++ Coding Style
================
Kakoune is written in C++20, here are the main coding style points:
* Avoid external dependencies besides posix/stdc++
* 4 spaces for indentation, no tabs
* public interface before private methods/data when defining a class
* use +override+ keyword for overridden virtual methods
* opening brackets on their own lines by default, except when declaring
an object where the opening bracket follows the equal sign.
* use alternative logical operator names (and, or, not instead of &&, ||, !)
-----
int func()
{
if (condition)
{
...
}
else
statement;
}
int array[] = {
...
};
-----
* End lines with an operator when continuing on the next line
----
if (condition1 or
condition2)
----
* Try to keep under 80 columns, even though this is not a strict limit.
* CamelCase for types, snake_case for variables/function names
* prefix fields with m_, static ones with ms_ except for dumb structs
(struct with every field public) where these prefixes can be dropped.
* use const and constexpr liberally