Re: Hard API freeze soon



On Fri, 2005-02-25 at 19:58 -0500, Carl Nygard wrote:
> On Fri, 2005-02-25 at 11:20 +0100, Murray Cumming wrote:
> > On Thu, 2005-02-24 at 14:31 -0500, Carl Nygard wrote:
> > > On Thu, 2005-02-24 at 19:15 +0100, Murray Cumming wrote:
> > > > On Thu, 2005-02-24 at 13:11 -0500, Carl Nygard wrote:
> > > > > On Thu, 2005-02-24 at 16:07 +0100, Murray Cumming wrote:
> > > > > > On March 9th, we'll release gtkmm 2.6.0, as per the schedule:
> > > > > > http://www.gnome.org/start/2.9/
> > > > > > 
> > > > > > We are already past the API freeze, but after March 9th there will
> > > > > > really be absolutely no chance to change the API. So, please do
> > > > > > experiment with the new 2.6 API now. See NEWS to see what's new.
> > > > > > 
> > > > > 
> > > > > I'm not sure if this would be allowable, but would you consider adding:
> > > > > 
> > > > > Glib::RefPtr<T_CppObject>::operator T_CppObject*() const
> > > > > 
> > > > > I've found I needed to get the raw pointer on occasion,
> > > > 
> > > > Not until you tell us what the occasion is, because this would encourage
> > > > people to do this when they shouldn't, leading to all kinds of confusion
> > > > and brokenness. So far we know of none.
> > > 
> > > a) I want to print out the value, just for debugging purposes.
> > > b) I want to pass the ref_ptr to a function taking the raw ptr
> > > 
> > > class MyScreen : public Gdk::Screen {}
> > > class YourScreen : public Gdk::Screen {}
> > > 
> > > void FooFunction(Gdk::Screen* screen) {   //.... }
> > 
> > There should not be any functions that take the raw pointer.
> 
> Can you give me alternatives to the code I proposed?  Without requiring
> hackish *_cast<> operators?

void FooFunction(const Glib::RefPtr<Gdk::Screen>& screen)

You can pass a const Glib::RefPtr<MyScreen> to that function too. It'll
cast implictly just like a regular pointer.

Furthermore, any class that derives from one of these classes (a class
that must be used via RefPtr) must be used via RefPtr.

I think this shows the proposed change would encourage you to make
mistakes.


-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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