[PATCH]: libev-3.8; ev++.h bug and warning fixes.

Konstantin Lepa konstantin.lepa at gmail.com
Fri Aug 28 18:41:43 CEST 2009



>> Example code:
>
> Indeed, your code is buggy:
>
>>  void TimerCallback() {
>
> The (documented) correct prototype is:
>
>>  void TimerCallback(ev::timer &w, int revents) {
>
> After fixing your code, it compiles fine on my system, and will do  
> so on
> freebsd as well.
>

Because you call method_thunk, but i use method_noargs_thunk.  Look:
It's your call:
   template<class K, void (K::*method)(watcher &w, int)>
     void set (K *object) throw ()
     {
       set_ (object, method_thunk<K, method>);
     }

It's my call:
     template<class K, void (K::*method)()>
     void set (K *object) throw ()
     {
       set_ (object, method_noargs_thunk<K, method>);
     }

And:
    template<class K, void (K::*method)(watcher &w, int)>
     static void method_thunk (EV_P_ ev_watcher *w, int revents)
     {
       (static_cast<K *>(w->data)->*method) // GOOD: there are  
parentheses!
         (*static_cast<watcher *>(w), revents);
     }

     template<class K, void (K::*method)()>
     static void method_noargs_thunk (EV_P_ ev_watcher *w, int revents)
     {
       static_cast<K *>(w->data)->*method // ERROR: there aren't  
parentheses!
         ();
     }


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20090828/d8b357df/attachment.html>


More information about the libev mailing list