I went to C++ On Sea again this year, attending the main conference. I spoke about Swarm Optimisation algorithms. I wrote a brief blog post about these a while ago, if you want a quick overview. I also hosted the lightning talks.
On the first evening, we had six speakers and a last minute bonus from Jon Kalb:
- Jan Wilmans, A Magical chat about C++ with GPT3+
- Anders Schau Knatten, C++ Quiz
- Cassio Neri, My favourite UB - Part II Russell's Paradox in C++
- Sanket Singh, Unlocking the Power of Advanced C++ Compiler Flags: Boost Performance and Debugging Efficiency
- Amir Kirsh, delete [ ]
- Mark Williamson, Undoom - reviving a zombie with a time travel debugger
- Jon Kalb, Wisdom in Keywords
I was speaking directly beforehand, which was a challenge. People sign up and send me slides (unless they are doing a demo on their laptop), so I couldn't poll emails while I was talking. I had prepared a game of "Coding rockstars" beforehand - or at least had some pictures and ideas. For example, a picture of Taylor Swift. See what I did there?
On Thursday, (almost) immediately before the speakers' dinner, we had another session of lightning talks, with more speakers this time:
- Andrew Drakeford, Variadic Reduction
- Sandor Dargo, Do engineering teams really resemble sports teams?
- Roth Michaels, Spelling and Pronunciation in C++
- Daniel Jump, Replacing legacy string type
- Koen Poppe, Implicit conversion, friend or foe
- Kris Jusiak, Static assert is almost all you need!
- Alex Merry, Slide Core Guidelines
- Phil Nash, All the Defaults Are Backwards : Let's Fix That
- Ambrus Tóth, HyloDoc: Documentation Compiler for Hylo
Next up, for me, was Jason Turner talking about constexpr. He started simple, and gradually added more details. I will need to relisten to this, because I know he covered a few edge cases I hadn't thought of, like lambda captures. I have noted constexpr doesn't change the lifetime of an object. On the face of it, that's obvious, but it's too easy to think it's some value baked in at compile time.
Next I listened to (some of) Björn Fahller's talk on cache friendly data structures. I was busy piecing together lighting talks, so hid up on the balcony to avoid being disruptive. He was talking through a data structure with good locality of reference and showed efficient filters and deletes, and I did note down his github link. This says "Elements are kept packed towards the beginning of each column, but can be referenced using stable row_id type." This means tracking what has been deleted. One of many cases where a relatively easy to state problem leads to lots of thinking.
I spoke next, giving a high level overview of many nature inspired "swarm" algorithms, and then went into depth on the Cat Swarm algorithm. You're right, cats don't swarm, but each swarm algo has agents with a position and velocity. The position is a potential numeric solution to a problem, and the velocity gives agents a trajectory, which changes over time, moving towards better places, for some definition of better. In our case, up mean the cat would be let out of a paper bag, so higher coordinates were more likely.
After the lightning talks, I wanted to collapse in a heap. A small gang of us went to a Turkish restaurant just down the road, which serves a mix of vegetarian friendly and meaty food, in huge portions. Five stars.
Thursday was less intense, which allowed me to concentrate on Cassio Neri's dragon talk. The full title was A new dragon in the den: fast conversion from floating-point numbers. Another easy to describe problem - print a numeric value. But how many digits, and how quick can you make it? He introduced a new algorithm called Teju Jagua which is a mythological monster: Cassio took great delight in telling us the tale. He's a great story teller. I'll have to go back slowly through the clever maths he did, but meanwhile here's a picture of the seven headed monster:
Next, I went to Jonathan Müller's talk An (In-)Complete Guide to C++ Object Lifetimes. There were so many C++ features I've either never used, like std::launder, or never heard of like std::destroy_at or std::start_lifetime_as. It's always good to discover new language features but my brain was melting by the end of this talk.
I went to see next, talking about Elevating Precision in C++: A journey below the surface of floating-point. Two floating point talks in one day might seem a bit much, but I've not heard him speak before, and he asked me to sign a copy of my Learn C++ by Example book earlier, so I went to his talk. He talked about Dekker doubles, which led to an obligatory joke about double decker (buses). He asked if anyone knew what a bfloat was, and I made a fool of myself guessing the 'b' stood for binary - clearly not, on reflection. It's a brain float (bfloat16), It's used for serious numerical computing, including neural networks, hence the name. Wikipedia tells me
It preserves the approximate dynamic range of 32-bit floating-point numbers by retaining 8 exponent bits, but supports only an 8-bit precision rather than the 24-bit significand of the binary32 format.Daniela Engert then gave her keynote, called Not getting lost in translations. She was talking about Unicode, and how much you can do at compile time. Of course, constexpr got a mention again. I listened, while being mildly distracted by lightning talk emails, but made no notes. I know she showed some really interesting approaches, but I'll have to listen to the recording. It's nice to just listen and let your brain wander once in a while.
We then had more lightning talks, being less ambitious for the in-between parts. I wasn't sure what to go for after coding rockstars, so I just asked "What's next?" For example,
1, 2, 3, ?
Yep. 4. Start simple. We went downhill from there though.
I started Friday with Roth Michaels' How and when to write a template. This was part of the C++ fundamentals track labelled as for beginners. Again, we started simple. For example std::string is a template. Roth then considered various types of templates:
- class
- function
- alias
- variable
- lambda
As you might imagine, things got complicated, and Roth somehow covered EVERYTHING. I knew almost all the ideas he covered, such as std::visit, template template parameters and a question sparked a brief discussion about splitting templates into two header files, including an impl.h, to avoid all the things in one place. I'd forgotten about doing that.
Next, I went to see Tristan Brindle talking about Practical Tips for Safer C++. This was also in the C++ fundamentals track, this time aimed at beginner or intermediary level. He talked about trapping or wrapping integer overflow, again starting with some simple slides, asking if code was potentially unsafe. Simple things, like sorting numbers can lead to trouble if your container has NaNs. So he suggested using std::is_lt for sorting. He mentioned his Flux library once or twice - it's worth looking at. One point he made, which cropped up several times at the conference, is constexpr can find UB.
- link time
- virtual functions and inheritance
- templates including concepts
- type erasure
- null objects or stubs
He rejected the first approach quickly. It gets out of hand too easily. He then showed examples of the other approaches, which were all useful. The essence of his talk was approaches to take to make code testable.
This led on nicely to the next talk by Steve Love, called Testable by Design. Steve built up an example of a thermostat and heating controller. Again, this started simple, and he showed various ways to chain together code, so the heating would go on or off at various times of day, without using the system time directly. If you do that, you are in danger of having a test that only passes at certain times of day.
It was a great conference, and I met new people as well as catching up with friends. Thanks to everyone who was brave enough to give a lightning talk, ask a question in a talk, or willing to attempt to answer a question from a speaker, even if they got it wrong.