Article View: gnu.g++.bug
Article #934Re: g++ 2.2.2 runs constructor even if operator new() returns 0 - gnu.g++.bug #2467
From: Tom McConnell~
Date: Thu, 10 Sep 1992 07:45
Date: Thu, 10 Sep 1992 07:45
44 lines
1935 bytes
1935 bytes
In article <18lnbdINN1no@agate.berkeley.edu>, jbuck@forney.berkeley.edu (Joe Buck) writes:
> The history so far: the issue is the fact that g++ does not generate
> a test for operator new() returning 0 before invoking the constructor
> in an expression
>
> new Foo
>
> where Foo has a constructor. The reason for this is to generate more
> efficient code; the new_handler function can be used to trap on
> out-of-memory conditions for the common case where all you can do when
> memory runs out is quit.
<stuff deleted>
> I think that a good interim solution, until the language has exceptions
> or the ANSI committee decides the issue, is to make the generation of the
> test conditional; if the user supplies
>
> -ftest-new
>
> then the compiler will generate code to test the result of operator new;
> if not, the test will be omitted.
<stuff deleted>
> This would imply that "-fno-test-new"
> would turn the flag off.
>
> --
> Joe Buck jbuck@ohm.berkeley.edu
>
This sounds like a good start. The nice part of this is that it will be easier
to identify problems with the new operator.
Cheers,
Tom McConnell
Tom McConnell | Internet: tmcconne@sedona.intel.com
Intel, Corp. C3-91 | Phone: (602)-554-8229
5000 W. Chandler Blvd. | The opinions expressed are my own. No one in
Chandler, AZ 85226 | their right mind would claim them.
Technical Details
Message-ID:
<9209102145.AA22631@thunder.intel.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sedona.intel.com!tmcconneShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sedona.intel.com!tmcconne From: tmcconne@sedona.intel.com (Tom McConnell~) Subject: Re: g++ 2.2.2 runs constructor even if operator new() returns 0 - gnu.g++.bug #2467 Message-ID: <9209102145.AA22631@thunder.intel.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 10 Sep 1992 07:45:04 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 45