[wix-devs] S_FALSE/E_NOTFOUND -> S_OK

Bob Arnson bob at firegiant.com
Wed Oct 14 15:08:22 PDT 2015

I usually love the WiX native coding style but one that bugs me is:

if (E_NOTFOUND == hr)
    hr = S_OK;

Four lines really clog up the screen especially with all the repetition for typical XML parsing (especially when throwing in S_FALSE too).

What do y'all think about something like this:

#define NotFoundIsOK(hr) if (E_NOTFOUND == hr) { hr = S_OK; }

hr = XmlGetAttributeEx(pixn, L"Name", &pFoo->sczName);
ExitOnFailure(hr, "Failed when querying foo Name.");

FireGiant  |  Dedicated support for the WiX toolset  |  http://www.firegiant.com/

More information about the wix-devs mailing list