[zeromq-dev] Alignment of message.raw_data()

Jon Dyte jon at totient.co.uk
Fri Sep 6 10:24:18 CEST 2013


Hi Michi

I'm not aware of any way at present to force the alignment of the buffer.
There's also a secondary issue that for OMQ very small messages the buffer
data is actually just bytes directly within the msg structure where the
alignment would probably not hold either.

zmq::msg_t::init_size is the first place to look, if you were to consider a
patch. ;-)

Jon


On 6 September 2013 06:12, Michi Henning <michi at triodia.com> wrote:

> Oops, forgot to actually mention that, yes, there *is a receive between
> the declaration and use :-)
>
> zmqpp::message msg_in;
> s.receive(msg_in);
> auto data = msg_in.raw_data();
> assert((long int)data % 8 ==0);
>
> Michi.
>
> On 06/09/2013, at 14:55 , Michi Henning <michi at triodia.com> wrote:
>
> > Hi,
> >
> > I'm using ZeroMQ with Cap'n Proto, which requires marshaling data to be
> > aligned on a 64-bit boundary. However, when I receive a message, like
> > this, the returned pointer is only byte-aligned:
> >
> > zmqpp::message msg_in;
> > auto data = msg_in.raw_data();
> > assert((long int)data % 8 ==0);
> >
> > The assertion fails for me. Checking the pointer value indicates that it
> > points one byte past the end of an 8-byte boundary.
> >
> > Is there any way to ask ZeroMQ to use 64-bit aligned buffers?
> >
> > Thanks,
> >
> > Michi.
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130906/e605d92a/attachment.htm>


More information about the zeromq-dev mailing list