On 14-01-07 08:04 PM, Kyle Huey wrote:
On Tue, Jan 7, 2014 at 11:29 AM, Benoit Jacob <jacob.benoi...@gmail.com>wrote:
For example, if I'm scanning a function for possible early returns (say I'm
debugging a bug where we're forgetting to close or delete a thing before
returning), I now need to scan for NS_ENSURE_SUCCESS in addition to
scanning for return. That's why hiding control flow in macros is, in my
opinion, never acceptable.
If you care about that 9 times out of 10 you are failing to use an RAII
class when you should be.
Since we seem to be voting now, I am moderately opposed to making XPCOM
method calls more boilerplate-y, and very opposed to removing
NS_ENSURE_SUCCESS without some sort of easy shorthand to test an nsresult
and print to the console if it is a failure. I know for sure that some of
the other DOM peers (smaug and bz come to mind) feel similarly about the
latter.
Would a macro starting with RETURN_ be an improvement over NS_ENSURE_?
e.g.
nsresult rv = Foo();
RETURN_AND_WARN_IF_FAIL(rv);
It's a mouthful (handful?) to type, but it's a single line and makes
explicit what's going on.
--m.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform