From 1765025156197725441
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,f5d433881cc29cff
X-Google-Attributes: gidf78e5,public
From: Valentin Bonnard <bonnardv@pratique.fr>
Subject: Re: Named return value optimisation- reprise.
Date: 1997/06/27
Message-ID: <33B3CF67.5BBF@pratique.fr>#1/1
X-Deja-AN: 253004763
References: <33a345bf.7425526@news.ipswich.gil.com.au> <5o7lbs$3a6@mulga.cs.mu.OZ.AU> <01bc7bf8$bb2c9be0$a56dadce@azguard> <33a885f3.6004413@news.ipswich.gil.com.au> <5oet82$b5g@tools.bbnplanet.com> <33af2d84.11809049@news.ipswich.gil.com.au>
X-Original-Date: Fri, 27 Jun 1997 16:34:16 +0200
Organization: Internet Way
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBM7P2EEy4NqrwXLNJAQGrRgH/SNEV9BTLv+djksYB+njQ99silxhMpbdx Jmd827Au+BK2//bRRlmWUkYra38LA487zUrnEEquqrlqPTEfNvgPCQ== =AE6O
Reply-To: bonnardv@pratique.fr
Newsgroups: comp.std.c++
Originator: austern@isolde.mti.sgi.com


Brian Parker <bparker@gil.com.au> writes:

> I was unclear in my original posting- what I meant to say was that the
> internal dynamically-allocated memory of local objects could be
> retained by a GC, not that the automatic object itself was affected by
> the garbage collector (also note that I am not particularly defending
> that as a good design- I'm just pointing out that that it can happen).

I don't understand how it is supposed to work: 

int* p;
int t[] = {1, 2, 3};
{
    gc_vector<int> v (t, t+sizeof t/sizeof (int));
    v.pushback (4);
    p = &v[1];
} // now p points to an element with value 2 in an unnamed array

p = 0; // how the elements are destructed; in particular, I would 
// guess that v.end_of_storage = v.finish + 2 (for * 2 reallocation).
// how is it possible to destroy elements in [start, finish) but not 
// in [finish, end_of_storage) ?

-- 

Valentin Bonnard
mailto:bonnardv@pratique.fr
http://www.pratique.fr/~bonnardv (Informations sur le C++ en Francais)
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



