[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question

From: Chuck Robey
Subject: Re: Question
Date: Sat, 16 May 1998 09:32:50 -0400 (EDT)

On Sat, 16 May 1998, John W. Eaton wrote:

> I believe that the `this' that's being deleted is a __bsrep object,
> not a basic_string object.
> The assignment operator checks to see that it is not trying to do an
> assignment to itself.  If it is not, it deletes the current contents
> of the string on the LHS of the operator= (possibly just decrementing
> the reference count).  This part of the operation is done in the
> rep()->release() function call.  Next it grabs a pointer to the data
> from the string on the RHS of the operator=, assigning it to
> this->dat.  The str.rep()->grab() function call also increments the
> reference counter.
> I think the code is ok.
> Does the following simpler test program work correctly?

Thanks for the explanation.  I will spend more time with a reading of
the bastring.cc/.h code, I would profit by it.  Your test program ran
ok.  I don't yet understand why I'm getting the sigbus right at that
point ... but I can make some additional tests regarding the state of
the "this" I guess. 

I've already done all the obvious things, like changing the compiling
flags, removing optimization, like that.  The npos operator is being
optimized out, but I haven't finished looking at possible side effects
(the compiler, I guess, thinks they're aren't any).

Chuck Robey                 | Interests include any kind of voice or data 
address@hidden         | communications topic, C programming, and Unix.
213 Lakeside Drive Apt T-1  |
Greenbelt, MD 20770         | I run Journey2 and picnic (FreeBSD-current)
(301) 220-2114              | and jaunt (NetBSD).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]