Skip to content

Commit

Permalink
Add design guidelines and be clearer on naming
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Kretz <kretz@kde.org>
  • Loading branch information
mattkretz committed Apr 7, 2016
1 parent 9ee50f0 commit c3d9d15
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,35 @@ the style rules:

* Naming is very important. Take time to choose a name that clearly explains the
intended functionality & usage of the entity.
* Type names typically use `CamelCase`.
* Function and variable names use `camelCase`.
* Type names typically use `CamelCase`. No underscores.
* Function and variable names use `camelCase`. No underscores.
* Acronyms that appear in camel case names must use lowercase letters for all
characters after the first characters. (e.g. `SimdArray`, `simdFunction`)
* Traits use `lower_case_with_underscores`.
* Macros are prefixed with `Vc_` and use `Vc_ALL_CAPITALS_WITH_UNDERSCORES`.
Macro arguments use a single underscore suffix.
Include guards are prefixed with `VC_` instead.
* File names use `alllowercasewithoutunderscores`. Basically it is the type name
* File names use `alllowercasewithoutunderscores`. Basically, it is the type name
declared/defined in the file with all letters in lower case.
* There are exceptions and inconsistencies in the code. Don't bother.

### Design Guidelines

* *Avoid out parameters.* Use the return value insted. Use `std::tuple` if you
need to return multiple values.
* *Look for alternatives to in-out parameters.* An obvious exception (and thus
design alternative) is the implicit `this` parameter to non-static member
functions.
* Consequently, *pass function parameters by const-ref or by value.*
Use const-ref for types that (potentially) require more than two CPU
registers. (Consider fundamental types and the fundamental `Vector<T>` types
to require one register, each.)
By value otherwise.
* *Ensure const-correctness.* Member functions use the `const` qualifier if they
do not modify observable state. Use `mutable` members for unobservable state.
* *Avoid macros.* Possible alternatives are constexpr variables and template
code.

## Git History

Git history should be flat, if feasible. Feel free to use merges on your private
Expand Down

0 comments on commit c3d9d15

Please sign in to comment.