[zeromq-dev] Question about constness

Ming Ji finalguy at gmail.com
Tue Jul 24 06:47:50 CEST 2012


Hi all,

I am new to ZeroMQ. I am actually not quite comfortable about the 
constness in the API.

For example,

size_t zmq_msg_size(zmq_msg_t* msg);

In my opinion, it is better to do it this way:

size_t zmq_msg_size(const zmq_msg_t* msg);

because this function by definition only returns the size of the 
message. It should not change the message itself. By adding the const 
there, developers can pass addresses of const messages into this function.

Any comments?





More information about the zeromq-dev mailing list