Hacker News new | ask | show | jobs
by DontGiveTwoFlux 2073 days ago
As someone who writes <5 commits of C++ per year, it is very frustrating. I can’t get through a code review without reviewers referencing at least 2 blog posts about proper style for modern C++. I’m sure if I were an expert who used it every day I could remember all the gotchas and best practices, but it sure is tedious to deal with occasionally. Too many foot guns and conventions, not enough constraints in the language.
5 comments

I'm sorry but why would you expect anything different from a language you rarely use? I've picked up Python the past few years and have come to love it, but I'm sure any seasoned vet would eviscerate me in a code review.
A lot of this comes down to expectations. I would treat C++ like, say, kind of like a cabinet full of chemicals, rather than like (say) a typical home toolbox. You (hopefully) don't just grab containers and mix their chemicals and expect to learn by doing that 5 times a year; you really need to start slowly and take time to learn all the dangerous pitfalls properly, or otherwise expect to be told exactly what to do down to the most minute details. Adequate training for it is simply a prerequisite. C++ is kind of similar in that respect.
> <5 commits of C++ per year,

I am sure any such developer will get equal treatment from another who is an expert, right?

So C++ doesn't have linters? Why not configure the subset acceptable.
Thankfully, one can stick to the C++ Core Guidelines now. Abseil also has some good recommendations. The rest is just bikeshedding.