[zeromq-dev] [PATCH] add zmq::version to C++ API
Martin Sustrik
sustrik at 250bpm.com
Tue Mar 15 11:24:48 CET 2011
On 03/15/2011 11:20 AM, Hoelzlwimmer Andreas wrote:
> Passing those parameters by reference gives you additional safety for the call.
> Additionally, in C++ lessons given to me, parameters by reference, especially for basic data types such as integers, were a sign for in/out parameters
The problem is that reference is visible only in the prototype of the
function, not with actual usage:
int i;
fx (i); // is this a reference or pass-by-value?
Thus, 0MQ C++ API uses pointers instead. See how send and recv work:
void send (message_t &msg);
void recv (message_t *msg);
And in actual usage:
zmq::message_t msg;
s.send (msg);
and:
zmq::message_t msg;
s.recv (&msg);
Martin
More information about the zeromq-dev
mailing list