aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-09-03 06:54:29 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-09-03 06:54:48 +0200
commit2736eb8ff2e95daf6ec8b2616d70381054d1a238 (patch)
tree2491b47ab8a8c64ff5293d12027a9356726dad0b
parentee678fac0ee09c6262c7a39b2b1072660e6db9ca (diff)
downloadlibquotient-2736eb8ff2e95daf6ec8b2616d70381054d1a238.tar.gz
libquotient-2736eb8ff2e95daf6ec8b2616d70381054d1a238.zip
CONTRIBUTING.md: update code conventions to C++20
-rw-r--r--CONTRIBUTING.md22
1 files changed, 12 insertions, 10 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c9296df1..3eeac68c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -155,18 +155,20 @@ just don't bankrupt us with it. Refactoring is welcome.
### Code style and formatting
-As of Quotient 0.6, the C++ standard for newly written code is C++17, with a few
-restrictions, notably:
+As of Quotient 0.6, the C++ standard for newly written code is C++17 with C++20
+compatibility and a few restrictions, notably:
* standard library's _deduction guides_ cannot be used to lighten up syntax
in template instantiation, i.e. you have to still write
- `std::array<int, 2> { 1, 2 }` instead of `std::array { 1, 2 }` or use helpers
- like `std::make_pair` - once we move over to the later Apple toolchain, this
- will be no more necessary.
-* enumerators and slots cannot have `[[attributes]]` because moc of Qt 5.9
- chokes on them. This will be lifted when we move on to Qt 5.12 for the oldest
- supported version.
-* things from `std::filesystem` cannot be used until we push the oldest
- required g++/libc to version 8.
+ `std::array<int, 2> { 1, 2 }` instead of `std::array { 1, 2 }` (or use
+ `Quotient::make_array` helper from `util.h`), use `std::make_pair` to create
+ pairs etc. - once we move over to the later Apple toolchain, this will be
+ no more necessary;
+* enumerators and slots cannot have `[[attributes]]` because moc from Qt 5.12
+ chokes on them - this will be lifted when we move on to Qt 5.13 for the oldest
+ supported version, in the meantime use `Q_DECL_DEPRECATED` and similar Qt
+ macros - they expand to nothing when the code is passed to moc.
+* explicit lists in lambda captures are preferred over `[=]`; note that C++20
+ deprecates implicit `this` capture in `[=]`.
The code style is defined by `.clang-format`, and in general, all C++ files
should follow it. Files with minor deviations from the defined style are still