Meeting 7 September 2017
Coding guidelines
- minimise smart pointer usage
- don’t use smart pointers to pass parameters by default: Herb Sutter
- don’t overuse the factory pattern: Herb Sutter
- return
unique_ptr
instead ofoptional<shared_ptr>
C++17 is formally approved
C++ has a Facebook page!
https://www.facebook.com/cplusplus
STL’s MinGW updated
STL on Twitter: Version 15.1 of my MinGW distro is now available, containing GCC 7.2.0, Boost 1.65.0, and grep 3.1: https://nuwen.net/mingw.html
Oracle Open Source Library now available to C and C++ developers
The production release of the Oracle Database Programming Interface for C (ODPI-C), which gives more streamlined access to C and C++ developers to Oracle Database, has been launched on GitHub.
Licence: UPL or Apache 2.
High Integrity C++ for Parallel and Concurrent Programming Coding Standard
© 2017 Programming Research Ltd.
RVO, NRVO, copy elision
Anti-pattern:
1Snitch CreateSnitch() {
2 Snitch snitch;
3 return std::move(snitch);
4}
What if copy constructor is deleted? ⇒ returning by value doesn’t compile.
Extending lifetime of temporaries
GotW #88: A Candidate For the “Most Important const”
1string f() { return "abc"; }
2
3void g() {
4const string& s = f();
5 cout << s << endl; // can we still use s?
6}
A series of articles on smart pointers
Why not Conan?
- Microsoft vcpkg FAQ
- Conan reply
- Public vs. private federation
- Per-DLL vs. per-application
- Cross-platform vs. single platform
- C++/CMake vs Python
Buckaroo
- Home :: Version 1.3
- Reddit thread
- Advantages over Conan
- Reproducibility, since the dependency graph is tracked via Git and file hashes
- No requirements to run a server, since everything is a file
- Faster builds using Buck
- Both Buck and Buckaroo depend on Java (!)
Hunter: yet another C++ package manager
Meson: yet another build system
- Apache 2 licence
- GitHub
- Written in Python 3
- Supports generating build files for Ninja, VS, Xcode
- Supports C++, C, Fortran, Java, Rust
G++ 7.1 for DOS by Jason Turner
- FreeDOS + DJGPP Linker (GCC 4.71)
- GCC 7.1 available!
- Cross-compiler build instructions
Cheatsheets of modern C++ features
C++ futures at Instagram
- Suggested users
- Chaining (30000 requests/s)
- Most services in Django, C++: fbthrift - Facebook’s branch of Apache Thrift - easily build RPC clients and servers that communicate seamlessly across programming languages
- Before: 1 thread per request
- Now: folly/futures with chaining
1doIO1(io1Input)
2.then([](Data io1Result) {
3 return doIO2(io1Result);
4})
5.then([](Data io2Result) {
6 return doIO3(io2Result);
7})
8.then([](Data io3Result) {
9 // do something else
10})
11.onError([](const std::exception& e) {
12 // handle errors in io1, io2 or io3
13})
asm-dom
asm-dom is a minimal WebAssembly virtual DOM to build C++ Web Apps. You can write an entire Web App in C++ and compile it to WebAssembly (or asmjs as fallback) using Emscripten, asm-dom will call DOM APIs for you.
Building Reactive Terminal Interfaces in C++
Rubber Duck Debugging
- Beg, borrow, steal, buy, fabricate or otherwise obtain a rubber duck (bathtub variety).
- Place rubber duck on desk and inform it you are just going to go over some code with it, if that’s all right.
- Explain to the duck what your code is supposed to do, and then go into detail and explain your code line by line.
- At some point you will tell the duck what you are doing next and then realise that that is not in fact what you are actually doing. The duck will sit there serenely, happy in the knowledge that it has helped you on your way.
Note: In a pinch a coworker might be able to substitute for the duck, however, it is often preferred to confide mistakes to the duck instead of your coworker.
Original Credit: ~Andy from lists.ethernal.org
C++ image processing libraries
- CImg: CeCILL ([L]GPL), can be used in commercial applications; started in 1999; 32-bit only?
- GEGL: Generic Graphics Library is a data flow based image processing framework, providing floating point processing and non-destructive image processing capabilities to GIMP and other projects ([L]GPL).
- Skia: an open source 2D graphics library; serves as the graphics engine for Google Chrome and Chrome OS, Android, Mozilla Firefox, and many other products (BSD).
- OpenImageIO: animation, VFX, film (BSD).