kakoune/doc/coding-style.asciidoc

52 lines
1.3 KiB
Plaintext
Raw Normal View History

2014-10-07 10:19:46 +02:00
C++ Coding Style
================
Kakoune is written in C++11, here are the main coding style points:
* Avoid external dependencies besides posix/stdc++/ncurses
2015-11-04 02:32:59 +01:00
- That means avoid depending on boost, it is only allowed for the regex
implementation. The reference for the current regex support is available under
http://www.boost.org/doc/libs/release/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html[Perl Regular Expression Syntax].
2014-10-07 10:19:46 +02:00
* 4 spaces for indentation, no tabs
* public interface before private methods/data when defining a class
2016-04-08 18:00:24 +02:00
* use +override+ keyword for overridden virtual methods
2014-10-07 10:19:46 +02:00
* opening brackets on their own lines by default, except when declaring
an object where the opening bracket follows the equal sign.
-----
int func()
{
if (condition)
{
...
}
else
statement;
}
int array[] = {
...
};
-----
* End lines with an operator when continuing on the next line
----
if (condition1 ||
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