GitHub user PragmaTwice edited a discussion: Update the C++ standard used by 
kvrocks to a newer version

C++ is an evolving language led by WG21 ([ISO/IEC 
JTC1/SC22/WG21](https://www.open-std.org/jtc1/sc22/wg21/)), which has been 
significantly modified over the years to improve ease of use and expressiveness 
while maintaining the zero-overhead principle.

The latest experimental standard for C++ is C++23 (also known as C++2b), and 
the latest stable standard is C++20. After C++11, WG21 has made a number of 
sweeping improvements to make modern C++ even more exciting. Among them, C++14 
[1] can be regarded as a series of small patches to C++11, which complemented 
the unsatisfactory parts of C++11, such as lifting some of the restrictions on 
constexpr functions, supporting variable templates and polymorphic lambdas; 
while C++17 [2] is a relatively big change, it supports constexpr if, 
guarantees more copy elision to improve efficiency, specifies a more explicit 
execution order to eliminate undefined behaviors, and brings several new 
library components such as filesystem, basic_string_view, any, optional, 
variant, and other class templates.

The industry has gradually become more comfortable with the new C++ standard, 
and here are some notable open source projects and the C++ standard they are 
using (in the main branch):

- clickhouse: c++20
- bitcoin: c++20
- mongodb: c++17 or c++20
- godot: c++17
- llvm: c++17
- taichi: c++17
- mysql: c++17
- rocksdb: c++17
- grpc: c++14
- tensorflow: c++14
- pytorch: c++14

I want kvrocks to use a newer C++ standard to apply rich new features to 
improve code quality and maintainability and have the ability to use the 
current version of rocksdb rather than stucking into an old version, and in 
particular, I want to update the standard to at least C++17. It is important to 
note that the new C++ standard will have significant breaking changes in only a 
few cases, but we can sort out later whether these changes will affect kvrocks. 
Also, all developers' experience with c++11 can continue to be used in the new 
standard.

C++17 requires a newer version of compilers like gcc or clang. In fact, this 
can be a compiler version from a few years ago (e.g., gcc7, 2017), but not an 
antique compiler from a decade old (e.g., gcc 4.8, 2013). As with the very new 
version of go 1.18 that we are currently using, I see no harm in encouraging 
users to use as newer versions of the compiler as possible, as long as they are 
not unstable versions. We do place restrictions on the compiler versions that 
users can use, and these restrictions are as follows:

gcc: 7 or above
clang: 5 or above

I'm not quite sure what expectations, concerns and questions people have about 
updating the standards at this point, and I look forward to everyone expressing 
their views on this issue!

[1] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1319r0.html
[2] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0636r2.html



GitHub link: https://github.com/apache/incubator-kvrocks/discussions/970

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to