[zeromq-dev] Message initialisation

Andrew Hume andrew at research.att.com
Thu May 1 20:17:11 CEST 2014


On May 1, 2014, at 10:50 AM, Pieter Hintjens <ph at imatix.com> wrote:

> On Thu, May 1, 2014 at 6:35 PM, Lars Tandle Kyllingstad
> <lars at kyllingen.net> wrote:
>> And my final question:  Is zmq_msg_init_size(&m, 0) by definition
>> equivalent to zmq_msg_init(&m)?  I have looked at the source code, and
>> it seems the two cases are currently implemented in the same way, but my
>> question is whether this is by specification, or whether it is an
>> implementation detail that may change in future versions.
> 
> Not documented, so open for change. If you think this should be
> formally specified, the right place would be the man pages, and if
> it's critical, then in a test case as well.


i wouldn’t document them as equivalent. i would prefer language that
said that every message must be initialised before use by calling one of
1) zmq_msg_init(&m)
2) zmq_msg_init_size(&m, int)
3) <future expansion>

as for the state after a zmq_msg_send, i would prefer language
along the lines of “if zmq_msg_send(&m) is successful, then
zeromq is responsible for m’s resources, and m is set to
an initialised state exactly as though zmq_msg_init(&m) had been called.
if zmq_msg_send failed, then m’s contents and state are unchanged.”


-----------------------
Andrew Hume
949-707-1964 (VO and best)
732-420-0907 (NJ)
andrew at research.att.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140501/9431af92/attachment.htm>


More information about the zeromq-dev mailing list