[zeromq-dev] zmq::tcp_listener_t::get_address

john skaller skaller at users.sourceforge.net
Sat Feb 18 16:23:57 CET 2012


On 19/02/2012, at 1:52 AM, Brian Knox wrote:
> 
> tcp_listener.cpp: In member function ‘int zmq::tcp_listener_t::get_address(std::string*)’:
> tcp_listener.cpp:148: error: dereferencing pointer ‘sa.120’ does break strict-aliasing rules

Nice that sa.120 is an impossible piece of syntax ..:)

> tcp_listener.cpp:148: note: initialized from here
> 
> <     struct sockaddr sa;
> 
> <         port = ntohs( ((struct sockaddr_in *)&sa)->sin_port);


Probably this. Casting a pointer to X to pointer to Y and then dereferencing
it isn't allowed (except in a few special cases, eg void, integers
of the same size).

--
john skaller
skaller at users.sourceforge.net







More information about the zeromq-dev mailing list