82 points · by marenkay · 9y ago · 43 comments
I'm basically looking into making the transition from a C++98 world into what is supposed to be Modern C++.
Since that is a rather opinionated field I'd love to see a few real world examples. Shoot links to your favourite Open Source project :-)
If you want something a bit more orthodox, or perhaps less depending on how you look at it, on the other end of the spectrum is the intensely engineered "Boost" libraries. Though, to be honest, that may be pushing it as far as "modern C++" goes considering it's written to support older C++98 compilers in many instances.
Qt 5 is one of my all-time favorite C++ projects, although it's again worth noting that it may be pushing it to consider it modern C++. I believe they're currently on C++11 with Qt, so a bit further than C++98. Still... there's plenty to learn about even older C++.
There's more out there, but those are the ones that come to mind for me. I have been out of the C++ game for a while now.
https://google.github.io/styleguide/cppguide.html
I've not read the whole thing, but it looks pretty solid. Of course, there's a lot of highly subjective suggestions, but I can get behind many of them personally.
Having recently started a project from "empty buffer" state we elected to go with C++17 (supported now in both GCC and clang although with some library features still missing). It's worked out well for us, but in my case I approached it as a brand new language rather than an evolution of old C++ (which I'd started in the cfront days and dropped around 2000). In that light it became and expressive and powerful systems programming language that is fun to use.
There may be compelling reasons to use exceptions, but if there were I think they have to be quite compelling to overcome the limitations.
Stockfish chess engine (currently 1st place by Elo). I am really impressed:
[1] https://msdn.microsoft.com/en-us/magazine/hh288076.aspx
[2] https://visualstudiomagazine.com/articles/2013/09/01/get-a-h...
Edited to fix footnote formatting
https://github.com/rigtorp/awesome-modern-cpp
A couple of my personal favourite libraries that I consider modern:
The Parsing Expression Grammar Template Library - https://github.com/taocpp/PEGTL
Beast: HTTP and WebSockets in C++11 - https://github.com/vinniefalco/Beast
Here is a short but useful terminfo parsing library I wrote - https://github.com/agauniyal/termdb
And here is another for console decorations - https://github.com/agauniyal/rang
Recently I worked on a network programming library (still WIP) for college project - https://github.com/c10k/net/tree/develop
And here is a boilerplate to get you all started with Continuous Integration, Unit tests etc etc - https://github.com/agauniyal/cppb
I try to write good code everywhere but since I lack experience so the code might not be perfect. Hence I advise to go light on it. Have a good day :)
https://www.reddit.com/r/cpp/comments/489f9l/open_source_pro...
https://www.reddit.com/r/cpp/comments/5sxrun/what_are_some_e...
My list:
SeaStar and ScyllaDB https://github.com/scylladb/seastar https://github.com/scylladb/scylla
Cap'n Proto https://github.com/sandstorm-io/capnproto
LLVM
range-v3 https://github.com/ericniebler/range-v3
Facebook folly https://github.com/facebook/folly
easylambda https://github.com/haptork/easylambda
Being one, this works like this.
Company X, which main business has 0% to do with software development requires a new feature on an application being used at deparment Y.
They send out an RFP to several consulting companies, the one that gets the gig, sends a few developers, which get a configured devenv from company X IT department and implemente the requested features and go away.
Manual memory management languages became out of fashion in such kind of companies, because it is almost impossible to jump into a gigantic ball of mud, while keeping track of all ownerships.
Also, a fan of the elegance on display is this serialization library: https://github.com/msgpack/msgpack-c
- rvalue&& (avoid few copies)
- enum class (enum with a size and a namespace)
The id Tech 4 engine is over a decade old, and like most game engines uses their own data structures. Many additionals to the C++ standard have been in the standard libraries.
Of course, I'm sure it has improved markedly since the Google Code days, but still...
That being said, on the other hand, there ARE some nice usages of modern C++ in certain parts. I also like their choice to move to #pragma once - I know it's non-standard but despite pretty intense arguments it seems to do the job just fine.