Nicholas Nethercote <n.netherc...@gmail.com> writes: > Hi, > > C++ constructors can't be made fallible without using exceptions. As a result, > for many classes we have a constructor and a fallible Init() method which must > be called immediately after construction. > > Except... there is one way to make constructors fallible: use an |nsresult& > aRv| outparam to communicate possible failure. I propose that we start doing > this.
Current coding style guidelines suggest that out parameters should use pointers instead of references. The suggested |nsresult&| will be consistent with |ErrorResult&| usage from DOM but against many other out parameters, especially XPCOM code. Should we special case that nsresult and ErrorResult as output parameters should always use references, or make it also the default style for out parameters? I think this topic has been discussed before didn't reach a consensus. Based the recent effort to make the code using somewhat consistent style, should we expend on this on the wiki? Kanru _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform