On 04/12/13 01:20, MacArthur, Ian (Selex ES, UK) wrote: >> @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?
No complaints here; checked the mountain lion compiler, VS 2010, and the most recent linux compiler I have, 4.4.6 I don't see a way around casting away const, because we want to use as_window() which, for some reason (?) is not const itself. (Seems it should be a const method, just like window() is) > 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) Yes, was thinking that myself, as I used that (a few lines up) at theend of the new top_window_offset() for the exact same reason (calling as_window()); will do that here as well, because that flies on all the compilers I have as well. > I think we should go for it... Done; r9875 + r9876. _______________________________________________ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev