> @manolo: Great -- agree with all, except perhaps loosing const here: > > - const Fl_Window *win = (const Fl_Window*)this; > + Fl_Widget *win = (Fl_Widget*)this; > > I think we can maintain const protection on the variable this way: > > const Fl_Widget *win = this; > : > return ((Fl_Widget*)win)->as_window();
Does that not throw a warning (or even an error) about casting away the const-ness of win, though? Without actually trying it, I imagined that it might... Maybe that's what Manolo was hoping to avoid? > ..this ensures const protection for all uses of win within the code, > and we only turn it off when we need to (eg. the non-const as_window() > call) That certainly sounds like a worthy intent, if it does not trigger any compile-time issues. I suppose we could do a more C++ish cast instead, so the compiler would know we really meant it! (i.e. const_cast) > Also, I should probably change all instances of 'win' -> 'w' in the > code, since it's really working with widgets now. Yes, I guess that would be right. > Thanks for the peer review -- will hold on comments regarding const > above, as am curious if there's a reason not to. I think we should go for it... Selex ES Ltd Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL A company registered in England & Wales. Company no. 02426132 ******************************************************************** This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ******************************************************************** _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
