On Wed, Apr 20, 2016 at 9:52 PM, Kris Maglione <kmagli...@mozilla.com> wrote:
> On Thu, Apr 21, 2016 at 02:10:59PM +1000, Nicholas Nethercote wrote: > >> On Thu, Apr 21, 2016 at 1:23 PM, Kris Maglione <kmagli...@mozilla.com> >> wrote: >> >>> >>> If we do this, can we please use |nsresult*| rather than |nsresult&|? >>> >> >> I prefer a reference because of the guarantee of non-nullness. But I >> could live with a pointer if people think it's better. >> > > There isn't a strict guarantee of non-nullness for reference parameters. > This is an extreme example, but technically valid: > > T th(*(nsresult*)0); > IIRC this is undefined behavior, so when you do this the compiler is allowed to format your hard drive. Or, somewhat more likely, a function which already takes a |nsresult*| > argument might do: > > T th(*aRv); > > I suppose either of those are less likely than someone passing |nullptr|, > but if we really want to guarantee non-nullness, we can do that easily > enough with a template type like GSL's |non_null|. > > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform > - Kyle _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform