Hi,

Sorry that I didn't add further argument. I was very busy with my work
when I saw Bill's reply, and planned to come back to it later, then it
slipped my mind...

Since the STR is closed, I will just reply to you. I can post it there
if you reopen the STR (if you think necessary).

Well, setting the callback in the constructor does achieve exactly the
same functionality,  but making Widget::do_callback() virtual just
need to add single keyword in front of the definition of
Widget::do_callback(), which would not add any complexity to fltk (but
add simplicity for coding). Though you may argue that calling a
virtual function may add some overhead, but such overhead should be
very little and probably not even observable. I guess the overhead for
calling a function pointer should be very similar to the overhead for
calling a virtual function, because both of them prevent optimization
by compiler (must be true in the case of fltk). Anyway, if you are
using C++ for fltk, probably it is not a bad idea to use some of the
features of C++.

There is another reason that make it appealing to have a virtual
Widget::do_callback() for automated tools to create scripting wrappers
of fltk. I created one such tool and found it is much easier to handle
virtual functions than function pointers automatically. This point
seems not very relevant to fltk, so I am not sure this can justify my
suggestion. But this could be something to be considered, if you don't
think it is a very bad idea to make Widget::do_callback() virtual.
Best,

Limin


On Nov 14, 2007 2:54 AM, Dejan Lekic <[EMAIL PROTECTED]> wrote:
>
> [STR Closed w/o Resolution]
>
> Link: http://www.fltk.org/str.php?L1774
> Version: 2.0-feature
> Fix Version: 2.0-current (r5971)
>
>
> I agree with Bill - I am closing this STR. No offense, but if there are
> some "hard" reasons (I would appreciate if you back it up with some
> arguments) other than "it would be cool" to do what this STR says, please
> post them here and I will gladly reopen it, and discuss it further. --
> Dejan
>
>
> Link: http://www.fltk.org/str.php?L1774
> Version: 2.0-feature
> Fix Version: 2.0-current (r5971)
>
>

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to