C++ in 2017
This project is to revisit C++ in 2017 and see how it compares to my recent experiences in Go.
I’ve written significant amounts of code in C, ‘C with objects’ style C++, Python, and (recently) in Go. I quite like Go and especially the tooling around it, but miss things like generic containers from C++ and optional values (i.e. value or None) from Python.
Find the state-of-the-art implementations of my favourite features from Go and Python and exercise them. These features are:
- A fast build / run cycle
- A package manager with a decentralised namespace
- Unit tests with automatic discovery
- Run-time inspection, especially being able to inspect a struct for fields.
- A light-weight / low configuration build system
- Easy cross compiling, especially for Raspbian
- Type free string formatting with positional args
- Documentation stored with the code
- Strict by default
- No explicit memory managemnt
- One True Way of formatting and tools to automatically reformat
- Cheap threads and channels so it’s easy to spawn a statemachine and push/pull events to/from it.
- Optionals (i.e. value or
- Functional style programming via lists and comprehensions
From other places:
- Dependency injection
My favourite control surfaces are:
- Prometheus for monitoring
- logfmt for structured logging that can be grepped
- YAML or INI for a config language
Prefer using features that come with C++17 over external libraries. Prefer systems that can be self-hosted.
The candidates to test are:
- Boost, especially Boost::Hana
rapidjson: has a DOM model and schema validator
json11: simple, consise
doctest / Catch
How do we know when we’re done?
Chunky steps along the way
|M1||W1||All foos have bars barred|
|M2||W3||All bazs are frobbed|
Risks and mitigations
What are the risks, likelyhood, impact, and ways of handling them?
- 7.9s with gcc-6.3
- 7.4s with clang-4.0 (with a link failure, so not exactly the same)