3 ms·
Since Dolphin-emu came up, in the realm of emulators I have to mention byuu's Higan emulator. It's got some really cool stuff going on, though the perfectionism
by jchw 9y ago
Since Dolphin-emu came up, in the realm of emulators I have to mention byuu's Higan emulator. It's got some really cool stuff going on, though the perfectionism is a bit intense (it has its own STL-replacement!) YMMV for some of the decisions, but seriously, there's a lot of great stuff. I always cite the ARM instruction decoder as being my favorite part, but there's really a lot of great use of cutting edge C++ all over the place. Byuu seems to adopt C++ features roughly as soon as GCC and Clang support them, or maybe sooner...
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.
- jchw 9y agoOh yeah, one last thing: not an example, but a pretty useful reference- Google's C++ Style Guide. https://google.github.io/styleguide/cppguide.html 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.
- gumby 9y agoNote that the style guide contains recommendations specific to Google's situation (they note this in the guide). For example they recommend against exceptions because by the time the style guide was written they already had an installed base. Had they started over they would use them. 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.
- jchw 9y agoTo be honest, I still don't use exceptions. They don't really feel all that great in C++, and I think Go has solidified my anti-exceptions attitude. A lot of the STL and standard libraries and even many third party libraries also abstain from using exceptions since they behave poorly across library boundaries on many platforms thanks to the lack of properly standardized ABI, and of course because the standard libraries try to be as unassuming as possible. Of course, you can still more or less safely use exceptions if you control your ecosystem, but since this is the case, it gives a (pardon my french) PHP feeling of inconsistency in many ways. There may be compelling reasons to use exceptions, but if there were I think they have to be quite compelling to overcome the limitations.
- Ace17 9y ago> since they behave poorly across library boundaries on many platforms thanks to the lack of properly standardized ABI, The same also holds for, say, std::string. You can't pass them across library boundaries without a unified ABI. More generally, you can't pass anything STL-ish between library boundaries. Why make a special case for C++ exceptions?
- jchw 9y agoBecause throwing an exception can bubble across library boundaries, including over C-style APIs that are fully compatible across library boundaries.
- mhh__ 9y agoIf your C-api throws and then doesn't handle exceptions, then it's not a C api, it just happens to use the C ABI.
- jchw 9y agoIt's more complicated than that, though, because a C library seldom controls the callstack. Exception throwing is viral. A valid example would be using a pure, fully ANSI C library with no dependencies in a C++ program, but then, in a callback PASSED to C APIs, accidentally allowing an exception to leak. Then, your runtime will try to unwind the stack and can implode on itself. There's definitely more valid cases where this can happen, but since C APIs generally do rely on callbacks for many things, it seems like a logical one. Another case would be C-style dispatch tables like SDLs RW interfaces. Implementing them to interact with C++ classes could definitely cause problems. Of course, happening to use the C ABI is a valid use case that actually works if you really only use the C ABIs, but once a single exception is raised all bets are off. This kind of sucks.
- sachinjoseph 9y agoC++ Core Guidelines: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md https://github.com/isocpp/CppCoreGuidelines/blob/master/CppC...