Article View: comp.std.c++
Article #2417Re: auto_ptr<T> as function return type
From: eddy Gorsuch
Date: Fri, 03 Nov 1995 18:11
Date: Fri, 03 Nov 1995 18:11
33 lines
2149 bytes
2149 bytes
In article <47b1um$fvs@infoserv.rug.ac.be>, Stein Somers <uunet!PROBLEM_WITH_INEWS_GATEWAY_FILE!somers@ncar.UCAR.EDU> wrote : [...] >This has been mentioned earlier, of course. So I'd like to repost >this recent uncountered reply: > >Eric Biederman (ebiederm@cse.unl.edu) wrote: >: The problem is that you are passing it as a standard pointer type. >: What happens if you were to run out of stack after the call to release >: and before the call to the constructor, or reset. And an exception is >: thrown. Ummm, who throws an exception if you run out of stack? I thought that came in as a signal (or other hardware error), not as a C++ exception. By the same token, what happens if you allocate some storage, then run out of stack space while trying to call the auto_ptr's constructor (or reset())? This leaves the same memory leak. I don't think these cases are (nor should they be) covered by the C++ standard. They are too machine/OS dependant. eddy -- ed.dy \'ed-e-\ n [ME (Sc dial.) ydy, prob. fr. ON itha; akin to OHG ith- again], L et and 1a: a current of water or air running contrary to the main current; esp)X : a small whirlpool 1b: a substance moving similarly 2: a contrary or circular current - eddy vb --- [ 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:
<47c7pe$722@eclipse.eng.sc.rolm.com>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backReferences:
<47616o$lvr@bcarh8ab.bnr.ca> <VANDEVOD.95Oct31222003@juicer.cs.rpi.edu> <9530600.21749@mulga.cs.mu.OZ.AU> <47b1um$fvs@infoserv.rug.ac.be>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 03 Nov 95 18:11:39 GMT Approved: fjh@cs.mu.oz.au From: eddy@clipper.robadome.com (eddy Gorsuch) Newsgroups: comp.std.c++ Subject: Re: auto_ptr<T> as function return type X-Original-Date: 2 Nov 1995 21:02:38 -0800 Organization: Siemens Rolm Communications Inc. Message-ID: <47c7pe$722@eclipse.eng.sc.rolm.com> References: <47616o$lvr@bcarh8ab.bnr.ca> <VANDEVOD.95Oct31222003@juicer.cs.rpi.edu> <9530600.21749@mulga.cs.mu.OZ.AU> <47b1um$fvs@infoserv.rug.ac.be> X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMJpbaeEDnX0m9pzZAQGVmAF/SA1Xbxo7NP/ZygxozfhvIxprO5sQ1vGn 04fZ4GVIBvkTeFZqqT4alcIEjP6VUi3U =UPu2