On Thu, Apr 21, 2016 at 11:07:21AM +1000, Nicholas Nethercote wrote:
Instead, we would do this:
nsresult rv;
T ts(rv);
if (NS_FAILED(rv)) {
return rv;
}
T* th = new T(rv);
if (NS_FAILED(rv)) {
delete th;
return rv;
}
If we do this, can we please use |nsresult*| rather than
|nsresult&|? It's easy enough to miss reference-based out params
when you're used to the conventions, and they're for
non-primitive types, like strings, that you might expect to pass
by reference. For primitive types, when you don't understand the
conventions, this is very hard to follow.
It's much more immediately obvious what's happening when you
read something like:
T ts(&rv);
if (NS_FAILED(rv)) {
return rv;
}
It doesn't seem worth sacrificing clarity to save one character.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform