Found this in a code review.
Well, in all candor, I didn’t find it; our automated code review tool found it. But I’m taking credit for it because I read the output of the automated code review tool. 🙂
Code rewritten because I’m too lazy to look it up.
// macros.h #define ENSURE_EQUAL(x, y) if (x != y) { bail(); } // implementation.cpp ... hr = foo(); ENSURE_EQUAL( foo_supported() ? S_OK : E_FOO_NOT_SUPPORTED, hr ); ...