[zeromq-dev] zmsg.hpp

Pieter Hintjens ph at imatix.com
Wed May 4 15:49:17 CEST 2011


On Wed, May 4, 2011 at 1:47 PM, Martin Lucina <mato at kotelna.sk> wrote:

> s[msg.length()] = 0 is standard C boilerplate for "If the
> message has no \0 termination, stick one at the end of the buffer just in
> case."

Yes. The message should in fact never have a null terminator, because
code that assumes it won't work with non-C/C++ apps.

At the same time it's pointless to ask C apps to work with
length-specified strings since none of the standard libraries can
handle it. Thus, a useful API has to convert to/from ASCIIZ, which is
why I introduced the notion of "0MQ strings", so we know what we're
converting from/to.

-Pieter



More information about the zeromq-dev mailing list