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



Alex Larsson <alexl redhat com> wrote:
> 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.

Well what is an 'invalid pointer' according to you. Yes, I have already been
told above that this pointer is not really invalid because the memory has not
been freed.

> Adding all sorts of bloat to disallow perfectly ok code seems really bad.

Perfectly OK code is good. And this seems to be OK. We are now in the realm of
the hypothetical. Hypothetically, an API should clearly represent it's
behaviour. An API that provides a pointer that can't be dereferenced is hardly
clear. Again, this code doesn't do that, so don't worry yourself about it any
more.

Murray Cumming
murrayc usa net
www.murrayc.com




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