Hacker News new | ask | show | jobs
by jpc0 5 days ago
Enable sanitizers on test suites and fuzzers.

Enable warnings and WError

Use clang tidy and other static analyzers

Actually use a modern compiler and enable the safety features they ship with

Most of these things have solutions that would take years of work in an existing project so it isn't done

And it takes significantly more effort to write good modern C++ code than Rust code

So Rust wins

But I don't like writing Rust code, I do enjoy writing modern C++ code, the tradeoff is modern C++ can be a tooling nightmare... Try shipping a modern stdlib on an old platform, it is truly infuriating, I don't want to be a build systems expert but I need to be to use a safer alternative.

3 comments

All those things you mention still have way more gaps in them than the rust compiler. They're just not really substitutes (fuzzing and sanitizing do still have their place in rust, though).
My experience is that unless that is pushed by DevOps teams, and being strict about it, no matter how long a build is broken, eventually they get disabled because there is this critical delivery, and then they are never enabled again.

Any language that isn't copy-paste compatible with C (or a subset of it), wins.

That is the biggest issue, old habits and old teaching materials keep working, a plus, and a curse.

> Actually use a modern compiler

This was always a pain point in C++ embedded space, to be fair.