🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2207

Re: overloading global new and delete

#2207
From: Steve Clamage
Date: Sat, 14 Oct 1995 21:58
34 lines
1804 bytes
In article 7351@mulga.cs.mu.OZ.AU, fjh@munta.cs.mu.OZ.AU (Fergus Henderson) writes:
>avm@zilker.net (Alfredo V. Mendoza) writes:
>
>>The program below was a testcase sent to IBM compiler defect group.
>>The problem is when compiled with IBM  (413) xlC 3.1.2 , and ran
>>the result is that the str() function in ostrstream  does NOT use
>>the overloaded new but uses the IBM runtime new. And when the class
>>is destroyed the memory that was allocated by str() is deleted by the
>>user defined global delete. Which (IMHO) is wrong.
>
>The `ostrstream' class is not part of the draft C++ standard.
>The old `char *' based strstream classes have been replaced by
>a new set of `string' based stringstream classes.
>
>So I'm afraid the draft C++ standard doesn't say anything about
>about the behaviour of ostrstream::str().

strstreams are in Appendix D, deprecated features, but still part of
the standard. The description of the overflow function in D3.1.3 says
it must evaluate the expression
	new charT[n]
to allocate space, which means calling the global "operator new[]()".

---
Steve Clamage, stephen.clamage@eng.sun.com




---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <45p7o1$oil@engnews2.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!news.duke.edu!agate!agate!Matt
References: <9528716.7351@mulga.cs.mu.OZ.AU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.duke.edu!agate!agate!Matt
From: clamage@Eng.Sun.COM (Steve Clamage)
Newsgroups: comp.std.c++
Subject: Re: overloading global new and delete
Date: 14 Oct 1995 21:58:23 GMT
Organization: Sun Microsystems Inc.
Approved: Matt@Austern
Message-ID: <45p7o1$oil@engnews2.Eng.Sun.COM>
References: <9528716.7351@mulga.cs.mu.OZ.AU>
Reply-To: clamage@Eng.Sun.COM
NNTP-Posting-Host: austern.hip.berkeley.edu