[zeromq-dev] ØMQ VSM data alignment

Martin Sustrik sustrik at 250bpm.com
Thu Aug 5 12:08:13 CEST 2010


Matt Weinstein wrote:

> Yes, but I want to do this:
> 
> zmq::message_t foo;
> 
> s.recv(&foo);
> my_struct const* pstruct = reinterpret_cast<my_struct const*>(foo.data());
> 
> cout << "Works like magic: " << pstruct->member << ". All your processor 
> are belong to Intel! (*)" << endl;
> 
> That's the no-copy approach :-)
> 
> I can do it with malloc() without issue or penalty...

Fair enough. Thus kind of stuff would break on RISC architectures such 
as SPARC.

What about having VSM buffer as the first member of zmq_msg_t?

Martin



More information about the zeromq-dev mailing list