[haiku-commits] Re: haiku: hrev48664 - in src/add-ons/kernel: file_cache network/stack src

  • From: Paweł Dziepak <pdziepak@xxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 12 Jan 2015 17:12:27 +0100

2015-01-12 16:53 GMT+01:00 Adrien Destugues <pulkomandy@xxxxxxxxx>:

> On Mon, Jan 12, 2015 at 10:25:56AM -0500, Augustin Cavalier wrote:
> > On Mon, Jan 12, 2015 at 4:14 AM, <pulkomandy@xxxxxxxxxxxxx> wrote:
> >
> > > c4718ea: Missing std::nothrow on new
> > >
> > >   Forgot to add this when migrating to BOpenHashTable.
> > >
> >
> > I thought the kernel doesn't have exceptions, so this isn't needed?
> >
> > Or is this for the future when we (might) have exceptions?
>
> I prefer to be safe. Some files may be used from userland (for example
> by userlandfs), and even if exceptions are disabled, it is better to
> inform the compiler and people reading the code that the new call can
> return NULL here.


It's not just a matter of preference. Compiler will gladly optimize out any
null checks if throwing allocation is used.

Paweł

Other related posts: