Matt Godbolt sold me on Rust (by showing me C++)
Published on: 2025-07-28 05:51:03
Matt Godbolt, of Compiler Explorer fame, is awesome and you should scour the web for every single bit of content he puts out. That is exactly what I was doing when I watched Correct by Construction: APIs That Are Easy to Use and Hard to Misuse. After 20+ years of working with C/C++, this theme resonates a lot with me.
While watching the talk I kept thinking "Yes! And that's why Rust does it that way." I came out at the end thinking that this talk was actually a great way of getting the intuition for how Rust helps you beyond the whole memory safety thing, and that is what this article intends to show.
But before we talk about that we should talk about the problems Matt raised and how he proposes to solve them in C++. Do yourself a favor and watch the full talk, but let me break one of them down!
What's in a type
Matt starts the talk by showing what a function that sends orders to a stock exchange might look like.
void sendOrder(const char *symbol, bool buy, int quantity, double pr
... Read full article.