[wix-devs] S_FALSE/E_NOTFOUND -> S_OK

John Cooper JoCooper at jackhenry.com
Wed Oct 14 15:11:31 PDT 2015

I like macros especially when they make the obtuse clear.  This is a clear case.

John Merryweather Cooper
Senior Software Engineer | Integration Development Group | Enterprise Notification Service
Jack Henry & Associates, Inc.® | Lenexa, KS  66214 | Ext:  431050 |JoCooper at jackhenry.com

-----Original Message-----
From: wix-devs [mailto:wix-devs-bounces at lists.wixtoolset.org] On Behalf Of Bob Arnson
Sent: Wednesday, October 14, 2015 5:08 PM
To: WiX Toolset Developer Mailing List <wix-devs at lists.wixtoolset.org>
Subject: [wix-devs] S_FALSE/E_NOTFOUND -> S_OK

The e-mail below is from an external source.  Please do not open attachments or click links from an unknown or suspicious origin.

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); NotFoundIsOK(hr); ExitOnFailure(hr, "Failed when querying foo Name.");

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

WiX Toolset Developer Mailing List provided by FireGiant http://www.firegiant.com/

NOTICE: This electronic mail message and any files transmitted with it are intended
exclusively for the individual or entity to which it is addressed. The message, 
together with any attachment, may contain confidential and/or privileged information.
Any unauthorized review, use, printing, saving, copying, disclosure or distribution 
is strictly prohibited. If you have received this message in error, please 
immediately advise the sender by reply email and delete all copies.

More information about the wix-devs mailing list