Skip to content

Commit aea0805

Browse files
fix: avoid C-style array in default announce address for Clang-Tidy
Use an inline accessor returning the multicast string literal instead of a constexpr char array. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 22b453e commit aea0805

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/nuclearnet/NUClearNet.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace network {
5353
/// This node's name on the network
5454
std::string name;
5555
/// The multicast/broadcast/unicast address to announce on
56-
std::string announce_address = DEFAULT_ANNOUNCE_ADDRESS;
56+
std::string announce_address = default_announce_address();
5757
/// The port to use for announce discovery
5858
in_port_t announce_port = 7447;
5959
/// Address to bind to (empty = all interfaces)

src/nuclearnet/wire_protocol.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ namespace network {
4242
constexpr uint8_t PROTOCOL_VERSION = 0x03;
4343

4444
/// Default organization-local multicast address for peer discovery (RFC 2365)
45-
constexpr const char DEFAULT_ANNOUNCE_ADDRESS[] = "239.226.152.162"; // NOSONAR
45+
inline const char* default_announce_address() {
46+
return "239.226.152.162"; // NOSONAR
47+
}
4648

4749
/// Packet type identifiers
4850
enum PacketType : uint8_t {

0 commit comments

Comments
 (0)