On 4 Sep 2003, Mike Hearn wrote:
Another possibility is to have a wine convenience macro, similar to the glib g_return_if_fail() macro, that works for instance:
wine_return_if_fail_hr(CoDoSomethingCOMRelated())
which expands to { HRESULT hr = CoDoSomethingCOMRelated() if (hr != S_OK) { ERR("CoDoSomethingCOMRelated() failed, hr=%ld\n", hr); return hr; }
I still find this ugly, but this is maybe just me. For someone looking at the code, it's cryptic. This is cleaner I find:
HRESULT hr = CoDoSomethingCOMRelated(); if (hr != S_OK) return hr;
And besides, all those errors will bloat the code to such an extent that we'll be forced to disable ALL tracing, even the good, hand-written one. The better solution is to make sure we have a decent way of failing in a function which is already the case in 99% of cases. No need to generalize and make it easier to do the wrong thing for the sake of that tiny portion of code that needs fixing anyway.