From 2736eb8ff2e95daf6ec8b2616d70381054d1a238 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 3 Sep 2021 06:54:29 +0200 Subject: CONTRIBUTING.md: update code conventions to C++20 --- CONTRIBUTING.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'CONTRIBUTING.md') 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 { 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 { 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 -- cgit v1.2.3