🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

handling of return values

#1015
From: Mark Grand
Date: Sat, 13 Apr 1991 19:47
35 lines
1490 bytes
My understanding of the semantic of the return statement is that the
expression following return is evalated, a copy of the value is
created using the appropriate copy constructor and the copy is
returned.  My question involves the circumstance

        extern MyObj foo();
                ...
        foo();

What becomes of the return value?  Borland C++ waits until it reaches
the end of the scope enclosing the call to foo() before calling the
destructor for its return value.  If a destructor is to be called then
when.  In a case such as

        extern MyObj foo();
                ...
      loop:
        foo();
                ...
        goto loop;

will a destructor be called for every value returned by foo()?
--
========

Mark Grand
Premenos Corporation                415-602-2073
1000 Burnett Avenue, Suite 200
Concord, CA   94520                 ...!attmail!premenos
				    ...!{sun, ames, att}!pacbell!premenos!mark
-- 
========

Mark Grand
Premenos Corporation                415-602-2073
Technical Details
Message-ID: <MARK.91Apr13124703@premenos.premenos.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!cs.uoregon.edu!ogicse!ucsd!pacbell.com!pacbell!premenos!premenos!mark

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!cs.uoregon.edu!ogicse!ucsd!pacbell.com!pacbell!premenos!premenos!mark
From: mark@premenos.premenos.COM (Mark Grand)
Newsgroups: comp.std.c++
Subject: handling of return values
Message-ID: <MARK.91Apr13124703@premenos.premenos.COM>
Date: 13 Apr 91 19:47:03 GMT
Sender: mark@premenos.uucp (Mark Grand)
Distribution: comp
Organization: Premenos
Lines: 35