A Defer Statement for C++11

19 Aug 2015 · 3 minute read

One of my favourite things about Go is the defer statement. The defer statement pushes a function call onto a list; the list of saved calls in called when the function returns.

Imitating this is C++ is impossible. Instead of calling when the function calls, you can call at the end of scope; this is a better approach for C++. This is similar to how D has scope(exit).


16 Aug 2015 · 1 minute read

I don’t know why, but I am now starting this blog. I can now rant with the whole internet being able to see it!