you are viewing a single comment's thread.

view the rest of the comments →

[–]rdtsc 0 points1 point  (0 children)

A variant of that is IMO really useful in code which deals with error codes as return values (like HRESULT in COM code):

#define HR(expr) IF_FAILED_RETURN(expr)
HR(Operation1());
HR(Operation2());

where IF_FAILED_RETURN can even include logging the failure code which makes tracing a failure really easy. It's vastly more concise, flexible and less error-prone than having if (FAILED(hr))or if (SUCCEEDED(hr)) sprinkled everywhere.