tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: more fun with MySQL cluster (actually C++)
On Sep 26, 11:34, nia wrote:
} On Fri, Sep 25, 2020 at 11:38:12PM -0700, John Nemeth wrote:
} > On the -9 box, kev.udata (from <sys/event.h>) is defined as intptr_t,
} > but on -current, kev.udata is defined as void *. With the EV_SET,
} > the error has to do with the last argument. On the -9 box, it is
} > defined as intptr_t, but on -current, it is defined as void *.
} >
} > I don't do C++. The code in question looks like:
} >
} > -----
} > if (kev.filter == EVFILT_TIMER) {
} > timer = static_cast<my_timer_t *>(kev.udata);
} > -----
}
} Someone else who understands C++'s type system better than me can
} probably offer a better response, but essentially static_cast is a
} stricter cast than standard C casts.
}
} reinterpret_cast allows you to do 'unsafe' C-style casts.
Thanks. I changed the above cast to reinterpret_cast, which
worked fine on -current (haven't tested -9 yet). The second item
was a problem with EV_SET. I changed it to cast to intptr_t, which
is the type used on -9, which implicitly caused a cast to void *
on -current, which failed.
-----
int my_timer_set(my_timer_t *timer, unsigned long time) {
struct kevent kev;
EV_SET(&kev, timer->id, EVFILT_TIMER, EV_ADD | EV_ONESHOT, 0, time,
reinterpret_cast<intptr_t>(timer));
return kevent(kq_fd, &kev, 1, NULL, 0, NULL);
}
-----
Any hints on how I can make this work on both -current and -9?
}-- End of excerpt from nia
Home |
Main Index |
Thread Index |
Old Index