aspell-devel
[Top][All Lists]
Advanced

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

Re: [aspell-devel] Saving pointers to std::vector data


From: Gary Setter
Subject: Re: [aspell-devel] Saving pointers to std::vector data
Date: Mon, 29 Aug 2005 20:40:54 -0500

----- Original Message ----- 
From: "Kevin Atkinson" <address@hidden>
To: "Gary Setter" <address@hidden>
Cc: <address@hidden>
Sent: Sunday, August 28, 2005 6:10 PM
Subject: Re: [aspell-devel] Saving pointers to std::vector data


> On Sat, 27 Aug 2005, Gary Setter wrote:
>
> > My recollection is that the addresses of object in standard
> > template library container object are not guaranteed to stay
> > valid. The
> > class is suppose to be able to reallocate memory as it needs
to.
> > Can anyone here back me up on this?
>
> For std::vector the address should remain valid as long as the
size of the
> object is not changed.  Gcc and possible also VC std:vector
never shrink
> so decreasing the size does not invalid address references into
an object.
> It could be the case the with BCB shrinking an object causes a
> reallocation.   Other objects (including the string class) do
not offer
> such a guarantee.
>
> > My plan is to continue looking into this and I may submit a
> > patch that eliminates the WordEntry intr field and replaces
it
> > with code that retrieves the data more directly. How I
continue
> > will be effected by your comments.
>
> Please submit a patch.  I may suggest an alternate solution but
I need to
> see your changes first.
>

Thanks Kevin,
I appreciate the explanation concerning the pointers becoming
corrupted.

One other thing that I noticed while playing with the suggest
module.
In Suggest::transfer(), we call check before adding a word to the
near_misses_final vector. This isn't the only place where late in
the process we call check before storing something away. Why is
that done? I would think that at that point a correction would be
have an acceptable spelling.

Best regards,
Gary





reply via email to

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