[zeromq-dev] Socket type
Martin Sustrik
sustrik at 250bpm.com
Mon Jan 16 23:27:55 CET 2012
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'.
Martin
More information about the zeromq-dev
mailing list