[haiku-development] Re: possible bad usage of "new" in haiku

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 03 Nov 2008 10:49:44 +0100 CET

romain.haiku@xxxxxxxxxxx wrote:
> And I wonder if we do not missuse the "new" operator in haiku. For 
> example
> in libbe.so, exceptions are not used (and afaik most/all of haiku 
> code do
> not use them also). According to the previous link, testing for new
> returning null is nonsense on new compilers. This may not be an issue 
> for
> the old gcc 2.95, but probably for 4.x.
> 
> I discovered the nothrow notion with this link so I may miss 
> something.
> Maybe we should make all haiku classes inherit from a common class 
> that
> would just overload new with something like that:

As inherited from the Be API, our API is indeed not supposed to throw 
any exceptions. Therefore, all API implementations are bound to use new 
(std::nothrow) all the time.
If you detect any usage of "new" without std::nothrow, please open a 
bug report for this or supply patches that fixes those instances.

Bye,
   Axel.


Other related posts: