Re: Promoting weak pointers

Andrew Tomazos <andrew@tomazos.com>
Thu, 18 Jun 2009 14:37:09 -0700 (PDT)

          From comp.compilers

Related articles
Promoting weak pointers m.helvensteijn@gmail.com (Michiel Helvensteijn) (2009-06-11)
Re: Promoting weak pointers fset.slb@gmail.com (Scott Burson) (2009-06-15)
Re: Promoting weak pointers andrew@tomazos.com (Andrew Tomazos) (2009-06-16)
Re: Promoting weak pointers m.helvensteijn@gmail.com (Michiel Helvensteijn) (2009-06-16)
Re: Promoting weak pointers m.helvensteijn@gmail.com (Michiel Helvensteijn) (2009-06-16)
Re: Promoting weak pointers m.helvensteijn@gmail.com (Michiel Helvensteijn) (2009-06-17)
Re: Promoting weak pointers bobduff@shell01.TheWorld.com (Robert A Duff) (2009-06-17)
Re: Promoting weak pointers andrew@tomazos.com (Andrew Tomazos) (2009-06-18)
Re: Promoting weak pointers armelasselin@hotmail.com (Armel) (2009-06-19)
Re: Promoting weak pointers dot@dotat.at (Tony Finch) (2009-06-19)
| List of all articles for this month |

From: Andrew Tomazos <andrew@tomazos.com>
Newsgroups: comp.compilers
Date: Thu, 18 Jun 2009 14:37:09 -0700 (PDT)
Organization: Compilers Central
References: 09-06-047 09-06-055 09-06-057
Keywords: linker, design
Posted-Date: 21 Jun 2009 16:47:38 EDT

On Jun 16, 3:55 pm, Michiel Helvensteijn <m.helvenste...@gmail.com>
wrote:
> However, I would argue that weak pointer promotion is in this instance
> only a workaround for ensuring the isolation of your pair of
> operations (testing for null and dereferencing). You did not really
> want to keep the object alive. You merely wanted to interact with the
> object iff it exists, which should be possible with a weak pointer.


I think you should study some prior art. Try and write up a concrete
analysis of the way that the following three weak reference
implementations work:


(1) java.lang.ref.WeakReference (Java)
        <http://java.sun.com/javase/6/docs/api/java/lang/ref/
WeakReference.html>


(2) System.WeakReference (C#)
        <http://msdn.microsoft.com/en-us/library/
system.weakreference.aspx>


(3) boost::weak_ptr (C++)
        <http://www.boost.org/doc/libs/1_39_0/libs/smart_ptr/weak_ptr.htm>


Enjoy,
Andrew.


--
Andrew Tomazos <andrew@tomazos.com> <http://www.tomazos.com>


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.