On Tue, 19 Jun 2001, Dom Lachowicz wrote:
> heap). So it's not like we're forgetting to call delete on them... or are we?
> I'm thinking that the destructor should get implicitly called here: Expert
> advice is sought after...
>
> void foo() {
> UT_String bar = "hiya";
> doSomething(bar);
> // destructor implicity gets called as we leave scope
> }
>
I can say that I've experimentally determined that pointers pointing to
bar.c_str() inside foo , point to garbage outside foo. I had to move some
UT_String 's to member variables because of this.
Cheers
Martin
Still an Experimental Scientist even while coding :-)