Skip to content

Commit ec99331

Browse files
committed
[nsapi] Fixed iar compilation issue with value initializer
Expression needed to init to zero a simple POD struct Before (valid in C99/C++11/G++): (nsapi_addr_t){} After (valid in C++03, invalid in C): nsapi_addr_t()
1 parent 9ab05ae commit ec99331

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

features/net/network-socket/SocketAddress.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void SocketAddress::set_ip_address(const char *addr)
182182
_addr.version = NSAPI_IPv6;
183183
ipv6_from_address(_addr.bytes, addr);
184184
} else {
185-
_addr = (nsapi_addr_t){};
185+
_addr = nsapi_addr_t();
186186
}
187187
}
188188

@@ -275,7 +275,7 @@ void SocketAddress::_SocketAddress(NetworkStack *iface, const char *host, uint16
275275
// DNS lookup
276276
int err = iface->gethostbyname(this, host);
277277
if (err) {
278-
_addr = (nsapi_addr_t){};
278+
_addr = nsapi_addr_t();
279279
_port = 0;
280280
}
281281
}

features/net/network-socket/SocketAddress.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class SocketAddress {
5353
* @param addr Raw IP address
5454
* @param port Optional 16-bit port
5555
*/
56-
SocketAddress(nsapi_addr_t addr = (nsapi_addr_t){}, uint16_t port = 0);
56+
SocketAddress(nsapi_addr_t addr = nsapi_addr_t(), uint16_t port = 0);
5757

5858
/** Create a SocketAddress from an IP address and port
5959
*

0 commit comments

Comments
 (0)