[wix-devs] S_FALSE/E_NOTFOUND -> S_OK
Heath Stewart
Heath.Stewart at microsoft.com
Thu Oct 15 14:47:52 PDT 2015
True, though it is a small self-explanatory macro. But you could also always inline it which improves debugging at least and you could streamline back to two lines:
inline HRESULT NotFoundIsOkay(__in HRESULT hr)
{
If (E_NOTFOUND == hr)
{
hr = S_OK;
}
Return hr;
}
...
Hr = XmlGetAttribute(...);
ExitOnFailure(NotFoundIsOkay(hr), "Failed ...");
Heath Stewart
Visual Studio, Microsoft
http://blogs.msdn.com/heaths
-----Original Message-----
From: wix-devs [mailto:wix-devs-bounces at lists.wixtoolset.org] On Behalf Of Neil Sleightholm
Sent: Thursday, October 15, 2015 2:03 PM
To: WiX Toolset Developer Mailing List <wix-devs at lists.wixtoolset.org>
Subject: Re: [wix-devs] S_FALSE/E_NOTFOUND -> S_OK
Marcos, hard to debug, just saying...
-----Original Message-----
From: wix-devs [mailto:wix-devs-bounces at lists.wixtoolset.org] On Behalf Of John Cooper
Sent: 14 October 2015 23:12
To: WiX Toolset Developer Mailing List <wix-devs at lists.wixtoolset.org>
Subject: Re: [wix-devs] S_FALSE/E_NOTFOUND -> S_OK
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 | https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.firegiant.com%2f&data=01%7c01%7cHeath.Stewart%40microsoft.com%7c1d4422f697a34bea533608d2d5a4140e%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=SgbYsc%2fJAEMsscgK1NDDRrpywZK6zrygefMDApwNfbc%3d
____________________________________________________________________
WiX Toolset Developer Mailing List provided by FireGiant https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.firegiant.com%2f&data=01%7c01%7cHeath.Stewart%40microsoft.com%7c1d4422f697a34bea533608d2d5a4140e%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=SgbYsc%2fJAEMsscgK1NDDRrpywZK6zrygefMDApwNfbc%3d
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.
____________________________________________________________________
WiX Toolset Developer Mailing List provided by FireGiant https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.firegiant.com%2f&data=01%7c01%7cHeath.Stewart%40microsoft.com%7c1d4422f697a34bea533608d2d5a4140e%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=SgbYsc%2fJAEMsscgK1NDDRrpywZK6zrygefMDApwNfbc%3d
____________________________________________________________________
WiX Toolset Developer Mailing List provided by FireGiant https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.firegiant.com%2f&data=01%7c01%7cHeath.Stewart%40microsoft.com%7c1d4422f697a34bea533608d2d5a4140e%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=SgbYsc%2fJAEMsscgK1NDDRrpywZK6zrygefMDApwNfbc%3d
More information about the wix-devs
mailing list