Hm. It's pretty unfortunate that we now need 4 lines per fallible call, as opposed to 2 with NS_ENSURE_* macros. The stylistic exception made this 3, which was slightly more palatable.
bholley On Tue, Jan 7, 2014 at 7:26 AM, smaug <sm...@welho.com> wrote: > On 01/07/2014 05:14 PM, smaug wrote: > >> On 01/07/2014 08:46 AM, Bobby Holley wrote: >> >>> On Mon, Jan 6, 2014 at 5:04 PM, smaug <sm...@welho.com> wrote: >>> >>> no, since it is always possible to expand those macros. >>>> However >>>> if (NS_WARN_IF(NS_FAILED(rv)) { >>>> return rv; >>>> } >>>> is super ugly. >>>> >>>> >>> Note that there in a explicit stylistic exception that NS_WARN_IF >>> statements do not require braces. So it's: >>> >> No exceptions. always {} with if. >> >> >> >> >>> if (NS_WARN_IF(NS_FAILED(rv))) >>> return rv; >>> >>> >>> Also, I agree that we should get NS_WARN_IF_FAILED. Then it becomes: >>> >>> if (NS_WARN_IF_FAILED(rv)) >>> return rv; >>> >>> which is almost as palatable as NS_ENSURE_SUCCESS(rv, rv); >>> >>> bholley >>> >>> >> >> > And looks like whoever updated the coding style made the examples > inconsistent, since there has pretty much always > (I think since the time coding style was somewhere in www.mozilla.org/*) > been the following "Always brace controlled statements", and > that is still there. No exceptions. Consistency is more important than > style. > > > > > > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform