From 3a466307d2d90961d10bc73c60eba002c9d7244d Mon Sep 17 00:00:00 2001 From: Mingjie Shen Date: Wed, 19 Apr 2023 01:24:19 -0400 Subject: [PATCH] Define default parameters of functions of derived class the same as the base class The member function bringup() of class ThreadInterface redefines parameter stack's default value to IPV6_STACK from the inherited default value DEFAULT_STACK (in Interface). The default value will be resolved statically, not by dispatch, so this can cause confusion. Similar arguments apply to LoWPANNDInterface and WisunInterface. --- .../nanostack/mbed-mesh-api/source/LoWPANNDInterface.cpp | 2 +- connectivity/nanostack/mbed-mesh-api/source/ThreadInterface.cpp | 2 +- connectivity/nanostack/mbed-mesh-api/source/WisunInterface.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/connectivity/nanostack/mbed-mesh-api/source/LoWPANNDInterface.cpp b/connectivity/nanostack/mbed-mesh-api/source/LoWPANNDInterface.cpp index 28c7d4145e..adb1bd3fe1 100644 --- a/connectivity/nanostack/mbed-mesh-api/source/LoWPANNDInterface.cpp +++ b/connectivity/nanostack/mbed-mesh-api/source/LoWPANNDInterface.cpp @@ -28,7 +28,7 @@ class Nanostack::LoWPANNDInterface final : public Nanostack::MeshInterface { public: nsapi_error_t bringup(bool dhcp, const char *ip, const char *netmask, const char *gw, - nsapi_ip_stack_t stack = IPV6_STACK, + nsapi_ip_stack_t stack = DEFAULT_STACK, bool blocking = true) override; nsapi_error_t bringdown() override; nsapi_error_t get_gateway(SocketAddress *sockAddr) override; diff --git a/connectivity/nanostack/mbed-mesh-api/source/ThreadInterface.cpp b/connectivity/nanostack/mbed-mesh-api/source/ThreadInterface.cpp index 5a3dac8fa0..89cf49df3a 100644 --- a/connectivity/nanostack/mbed-mesh-api/source/ThreadInterface.cpp +++ b/connectivity/nanostack/mbed-mesh-api/source/ThreadInterface.cpp @@ -27,7 +27,7 @@ class Nanostack::ThreadInterface : public Nanostack::MeshInterface { public: nsapi_error_t bringup(bool dhcp, const char *ip, const char *netmask, const char *gw, - nsapi_ip_stack_t stack = IPV6_STACK, + nsapi_ip_stack_t stack = DEFAULT_STACK, bool blocking = true) override; nsapi_error_t bringdown() override; friend class Nanostack; diff --git a/connectivity/nanostack/mbed-mesh-api/source/WisunInterface.cpp b/connectivity/nanostack/mbed-mesh-api/source/WisunInterface.cpp index 75f89eeca8..e9cdb3df09 100644 --- a/connectivity/nanostack/mbed-mesh-api/source/WisunInterface.cpp +++ b/connectivity/nanostack/mbed-mesh-api/source/WisunInterface.cpp @@ -34,7 +34,7 @@ class Nanostack::WisunInterface final : public Nanostack::MeshInterface { public: nsapi_error_t bringup(bool dhcp, const char *ip, const char *netmask, const char *gw, - nsapi_ip_stack_t stack = IPV6_STACK, + nsapi_ip_stack_t stack = DEFAULT_STACK, bool blocking = true) override; nsapi_error_t bringdown() override; nsapi_error_t get_gateway(SocketAddress *address) override;