Anti-IF idioms in C++ -- Marco Arena

I'm showing interactive examples of "anti-IF" idioms in C++, inspired by C# snippets which Claudio Pattarello proposed at the Italian Agile Day 2014.

Anti-IF idioms in C++

by Marco Arena

From the article:

In this post I’d like to show you how to rewrite these idioms in C++, starting from a C# snippet. And the resulting code is pretty much identical. [...] I'm not saying "this is the best thing you can do in C++". [...] Sure, we have specific idioms in our favorite language but I think it’s lovely that we are able to reuse the same code from other languages with a little effort. And this is also appealing for other programmers who want to experience C++, maybe by starting coding idioms they know. ...

Add a Comment

Comments are closed.

Comments (1)

0 0

jyasskin said on Nov 28, 2014 03:06 PM:

These are pretty bad. Why complicate the code and make it harder to understand in order to avoid one language feature?