0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 07:31:03 +08:00

Problem: non-portable memset

Solution: add dummy pointer meber to union instead
This commit is contained in:
Simon Giesecke 2018-05-30 13:32:29 +02:00 committed by Simon Giesecke
parent 9c8fde09ca
commit 93194e7c53
2 changed files with 3 additions and 1 deletions

View File

@ -51,7 +51,7 @@ zmq::address_t::address_t (const std::string &protocol_,
address (address_),
parent (parent_)
{
memset (&resolved, 0, sizeof resolved);
resolved.dummy = NULL;
}
zmq::address_t::~address_t ()

View File

@ -76,8 +76,10 @@ struct address_t
ctx_t *const parent;
// Protocol specific resolved address
// All members must be pointers to allow for consistent initialization
union
{
void *dummy;
tcp_address_t *tcp_addr;
udp_address_t *udp_addr;
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \