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]
Other format: [Raw text]

Re: "new" statement and -fno-exceptions


On Mon, Oct 04, 2004 at 04:13:49PM -0700, Mike Stump wrote:
> On Oct 4, 2004, at 6:37 AM, Paul Koning wrote:
> > We recently ran into some problems with an application being killed by
> > unhandled exception processing -- even though it's compiled
> > -fno-exceptions.
> 
> Ok.
> 
> > It turns out that a "new" statement will throw an exception on alloc
> > failure
> 
> Yes, it _is_ documented to throw on failure.? If you don't want it to 
> throw either never fail to allocate, or call one that doesn't throw, as 
> documented.? See nothrow_t in the standard.

I wouldn't blame the user for assuming that, with -fno-exceptions, use of
the "new" keyword would invoke the nothrow version of operator new.
Certainly the user who used -fno-exceptions to deal with ancient C++
code might expect that.


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