winft / wrapland

Qt/C++ library wrapping libwayland
GNU Lesser General Public License v2.1
6 stars 2 forks source link

Code style refinements #11

Open romangg opened 4 years ago

romangg commented 4 years ago

The project currently follows the KDE Frameworks Coding style as the CONTRIBUTING.md document prescribes. The style is not perfect and does not seem to be actively maintained. We might want to deviate from it, in particular because there is the opportunity to enforce a style with CI. Following a list of possible changes:

change reason
left reference/pointer alignment: int* x C++ Core Guidelines does it this way. Also see p. xxxii [1].
const qualifier always to the right: int const x See p. xxxi [1].
comment unnamed parameters or use [[maybe_unused]] both have advantages in certain situations
use lowercase snake-case style of STL
... ...

[1] Vandevoorde: C++ Templates: The Complete Guide

romangg commented 4 years ago

This is being executed on the server-objects branch as part of the server objects remodel prototype work #15.

The included clang-format check was adjusted to enforce the ref/pointer alignment. For the const position there is currently no clang-format check possible.

romangg commented 4 years ago

Server objects rework has been landed. We enforce the left reference/pointer alignment in there now with clang-format.

clang-format doesn't enforce const qualifier positioning though. Maybe something to look into in the future.

Let's leave this issue open for now to maybe define more refinements in the future.

romangg commented 3 years ago

Not all of the style can be enforced through clang-format. At some point we should formulate a style guide so it's clearly documented.