[zeromq-dev] Socket type

john skaller skaller at users.sourceforge.net
Tue Jan 17 00:40:42 CET 2012


On 17/01/2012, at 9:27 AM, Martin Sustrik wrote:

> On 16/01/12 10:29, john skaller wrote:
>> Why is a socket a void*, instead of
>> 
>> 	struct zmq_socket_type_t* // incomplete type *
>> 
>> ?
>> 
>> The above helps to prevent type errors by preventing conversions from
>> and to any pointer type other than void* (in C) (at least without a cast).
>> In C++ you get extra safety (C++ doesn't allow conversion from a void*).
> 
> Once again, copying POSIX. In this case the raw C type of 'int' representing socket in POSIX had to be replaced by raw C type of 'void*'. Still, when the 0MQ-like functionality is moved to the OS (see the related project) we'll have to use 'int'.


OK.

Well all this bad stuff you have to copy is good for Felix,
since it provides more incentive for people to use a more type safe
interface :)
 
--
john skaller
skaller at users.sourceforge.net







More information about the zeromq-dev mailing list