4 ms·
Has anyone recently written a non-trivial greenfield project using modern C++20? Or know of any such interesting projects on GH with very well written C++20?
by clpm4j 4y ago
Has anyone recently written a non-trivial greenfield project using modern C++20? Or know of any such interesting projects on GH with very well written C++20?
- varajelle 4y agoA fairly new and big C++ codebase: https://github.com/SerenityOS/serenity https://github.com/SerenityOS/serenity
- bowsamic 4y agoIt has its own STL replacement though
- jandrewrogers 4y agoMany C++ projects replace large parts of the STL. It isn't designed to support every use case.
- bowsamic 4y agoBut generally when people say "modern C++20" they are asking about the use of the modern STL concepts as well as the modern language additions. This is evidenced by looking at how much CppCon talks emphasise the STL
- brnt 4y agoIt's not C++20, but there's plenty of modern C++ (17, 14 mostly; the project started in 2015-ish): https://github.com/arbor-sim/arbor https://github.com/arbor-sim/arbor
- nyanpasu64 4y agoI'd say https://gitlab.com/exotracker/exotracker-cpp https://gitlab.com/exotracker/exotracker-cpp has fairly decent code quality (though I'm obviously biased as the author), but it's not feature-complete or useful, and I've put it on hiatus because it's a struggle to implement high-level editing, mouse interaction, copy-paste, etc.
- dataflow 4y agoA small critique of your code (though it does seem to me the overall quality is decent): watch out for unintended ADL. You call lots of unqualified namespace-level functions (like load(...)). This triggers ADL, and it doesn't look like it's always intentional.
- nyanpasu64 4y agoOof... ADL scares me, but I don't know which load(...) you're referring to. src/serialize.cpp has a single such function call, am I supposed to avoid using the name `load` or qualify it with the namespace path (perhaps I shouldn't have nested namespaces so deeply, but I don't want to change it now)? Everything seemed to compile and work fine the last time I touched this codebase.
- dataflow 4y ago> Oof... ADL scares me, but I don't know which load(...) you're referring to. src/serialize.cpp has a single such function call Yup that's the one I mentioned. It was just an example though, there are lots of others. > am I supposed to avoid using the name `load` or qualify it with the namespace path The latter. i.e. you should write serialize::load() (or ::serialize::load()) unless you intend ADL to occur. > Everything seemed to compile and work fine the last time I touched this codebase. Yeah I wasn't claiming it wouldn't compile right now. The problem is that it has a higher risk of changing behavior in the future. In this example, if this function is ever introduced: namespace kj { auto load(InputStream &stream) { ... } } then suddenly that function will get called instead of yours, which may or may not result in a compiler error. It's not exactly the biggest footgun in C++, but "well-written" C++ code tries to be careful about pitfalls like these.
- nyanpasu64 4y agoADL is, saddening. I want a language with the pragmatism of C++ rather than the "mutability excludes aliasing, no lifetime errors allowed, at the cost of usability, and no defined unsafe pointer semantics so far" unfinished experiment of Rust, with better sum type syntax than std::variant, and eliminating C++ footguns luke {implicit conversions, implicit copies, mixed-sign integer comparison, silently overriding virtual methods, C-style casts of multiple inheritance pointers is UB...}. Perhaps Cppfront holds promise, possibly Carbon or Jakt, maybe Zig though it lacks RAII when convenient and its return value semantics (much like Carbon's) is a footgun: https://github.com/ziglang/zig/issues/5973 https://github.com/ziglang/zig/issues/5973.
- jcelerier 4y agoThe projects I put here all leverage c++20: https://github.com/celtera https://github.com/celtera ; https://ossia.io https://ossia.io leverages it quite a bit
- leni536 4y agoWe started seriously looking into coroutines for async programming.
- moeris 4y agoI think the text editor, [Kakoune](https://github.com/mawww/kakoune https://github.com/mawww/kakoune), was written as an experiment in modern C++ language features. Its documentation says it requires a C++20 compiler, though I don't imagine it was originally for that version, since it was started before 2020.
- celrod 4y agoIt's my first real foray into C++ (most of my experience is with Julia) so code quality/awareness of idioms, etc are probably lacking, but it's using C++20 and I'd appreciate pointers if anyone has any: https://github.com/JuliaSIMD/LoopModels/blob/main/include/Math.hpp https://github.com/JuliaSIMD/LoopModels/blob/main/include/Ma... So far, I think C++20 seems like quite a nice language.