[zeromq-dev] Strict aliasing problem
Pieter Hintjens
ph at imatix.com
Thu May 17 16:24:46 CEST 2012
On Thu, May 17, 2012 at 4:14 AM, Bjorn Reese <breese at mail1.stofanet.dk> wrote:
> 1. As the only standards-compliant way "casting" between
> pointer-to-object and pointer-to-function is through a union, the
> zmq_monitor_fn type could be changed to something like:
>
> typedef union
> {
> void *object;
> void (*function)(void *s, int event, zmq_event_data_t *data);
> } zmq_monitor_fn;
This is what I'd do. It's not the simplest option but it a correct
one. Callbacks are going to be complex anyhow.
If we only want a single callback per context it could be registered
at the zmq_ctx_ level, with a neat API.
-Pieter
More information about the zeromq-dev
mailing list