Three things I've come to believe about post modern C++

| No Comments
In no particular order:

  • Template metaprogramming is still evil, and C++11/14 hasn't fixed anything about it. People argue metaprogramming enables "clean, elegant code," as if a home built on a garbage dump won't smell like garbage. If anyone else needs to repair or extend the foundation of your home they'll need to parse through your garbage pile to make changes. Template metaprogramming as a rule should simply never be done outside low-level libraries.
  • auto is too easy to abuse. Oh but, "the IDE makes auto easier to read!" Go back to Java. auto does have a few good uses, clang-tidy provides excellent guidance on where its effective, its guidance should be followed.
  • Large lambdas harm readability. They make the control flow of the program harder to parse and discourage self documenting code. Lambdas should be limited to 2-3 statements. And please, if you write a lambda, mean it: don't write a lambda where you could have just as easily written a standalone function.

Leave a comment

Myself

Projects

About this Entry

This page contains a single entry by Robert W. Rose published on March 14, 2017 9:36 AM.

The simplest BBQ brisket recipe on the Internet was the previous entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives