[zeromq-dev] [PATCH] Re: c++ api issues

Burak Arslan burak.arslan at arskom.com.tr
Sun Oct 24 21:24:10 CEST 2010


 On 10/22/10 01:26, Burak Arslan wrote:
>  On 10/21/10 18:13, Martin Lucina wrote:
>> Hi,
>>
>>> diff --git a/include/zmq.h b/include/zmq.h
>>> index 275f801..31d7ace 100644
>>> --- a/include/zmq.h
>>> +++ b/include/zmq.h
>>> @@ -149,6 +149,7 @@ ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg);
>>>  ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src);
>>>  ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src);
>>>  ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg);
>>> +ZMQ_EXPORT const void *zmq_msg_const_data (zmq_msg_t *msg);
>>>  ZMQ_EXPORT size_t zmq_msg_size (const zmq_msg_t *msg);
>>>  
>>>  /******************************************************************************/
>> Adding zmq_msg_const_data() implies a core API change, not likely to happen
>> just because of the lack of "const", sorry.
>>
>>
> that's fair. cases such as this (interoperability) are the sole reason
> why const_cast exist anyway.
>

for the record, i did not want to const-correct just the c++ api with
const_cast because const_cast's sole valid use-case is interoperability.
so the user should choose to use it if he/she's after strict
const-correctness.

so using it inside the zeromq c++ api is simply lying to the user.

burak.





More information about the zeromq-dev mailing list