Remove redundant static_cast<void*> in examples. #859
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not only is it unnecessary because
zmq::socket_t
automatically convertsto
void*
via operatorvoid*
, it is also misleading as the operator iscalled in spite of the appearance that it's "just" a cast.
Now, other comments in
zmq.hpp
indicate that this is not really theintent (note the comments near the bool conversion), and I believe the
cleanest fix would be to add a member to
zmq::socket_
t that returns thevoid*
needed for polling (.pollable()
? I really can't find a good name),or for
zmq::pollitem_t
to handle the conversion instead of having thismagical operator. But since this attempts to document what's there, I
think we should document what is there now while avoiding confusing
bits. As it is there is a C++ type
zmq::pollitem_t
which can be filledfrom
zmq::socket_t
without jumping through hoops, so let's documentthat even though one could infer from the man page for
zmq_poll
thata
static_cast<void*>
is needed.This PR is related to #858