Re: [Re: [Re: gobject weak references]]



Alex Larsson <alexl redhat com> writes:

> On 18 Sep 2001, Murray Cumming wrote:
> 
> > Alex Larsson <alexl redhat com> wrote:
> > > On 18 Sep 2001, Murray Cumming wrote:
> > > 
> > > > Oh, OK, if the memory hasn't been freed yet then I have no problem with using
> > > > the pointer.
> > > 
> > > In what way does it matter if it has been freed or not?
> > 
> > I wouldn't like an API to encourage the use of invalid pointers because that
> > increases the chance of segfaults.
> 
> The pointer is not invalid. It just points to invalid memory. And it is 
> called where_the_object_was for exactly this reason.
> 
> Adding all sorts of bloat to disallow perfectly ok code seems really bad.

OK, let's clarify.

 - The pointer points to allocated memory, so it is guaranteed to
   equal to the old pointer to the object, and to no other pointer
   to a currently live object.
 - But the contents of the allocated memory block are completely
   undefined.

Regards,
                                        Owen




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