# Coding Style

**URL:** <https://discuss.kakoune.com/t/coding-style/531>\
**Category:** Manual++\
**Created:** [May 8, 2019, 2:09am UTC](https://discuss.kakoune.com/t/coding-style/531 "2019-05-08T02:09:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertmeta](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/robertmeta/32/833_2.png) [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Post date:** [May 8, 2019, 2:09am UTC](https://discuss.kakoune.com/t/coding-style/531/1 "2019-05-08T02:09:39Z")

</div>

Kakoune is written in C++14, here are the main coding style points:

- Avoid external dependencies besides posix/stdc++/ncurses

- 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
