This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: g++: new that throw bad_alloc ?


> Date: Thu, 09 Oct 1997 16:42:55 -0700
> From: Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
> To: egcs@cygnus.com

> It would be nice to have the ability to let new throw bad_alloc

You have that ability already.  Just define a new that throws and use
it.  If this doesn't work, then that's a flaw, since that is the
intent.

> Here is my idea how it might be implemented:

> Make the default new handler check a flag when called.

I am against yet another flag.  There are far too many, and we should
look at ways of reducing them, not proliferating them.

> The default behavior is to display a message and exit for backward
> compatibility.

If we are happy with the quality and implementation of exceptions then
we can turn the default new routine into one that throws.  If the user
wants the nothrow routine, the user can call it.

I was just being conservative and wanted to be really sure that EH and
nothrow both work ok, and then later after some people with large
projects try out EH and throwing news in real code, and report back
that things work well, then change the default.

Do others think we should just turn on a throwing new, and work it
that way?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]