Skip to content

Commit a5bd5a6

Browse files
authored
Add noexcept annotation where applicable (#1244)
* NetworkDetector::RegisterAndListen does not throw exceptions, thus mark the method as noexcept. * RequestHandler::RequestHandler does not throw exceptions, thus mark the constructor as noexcept. * Constant intialization of member variables should be done using in-class initializers, not in the initializer-list.
1 parent 8e3697d commit a5bd5a6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/pal/desktop/NetworkDetector.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ namespace MAT_NS_BEGIN
330330
return true;
331331
}
332332

333-
bool NetworkDetector::RegisterAndListen()
333+
bool NetworkDetector::RegisterAndListen() noexcept
334334
{
335335
// ???
336336
HRESULT hr = pNlm->QueryInterface(IID_IUnknown, (void**)&pSink);

lib/pal/desktop/NetworkDetector.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ namespace MAT_NS_BEGIN
153153
/// Register and listen to network state notifications
154154
/// </summary>
155155
/// <returns></returns>
156-
bool RegisterAndListen();
156+
bool RegisterAndListen() noexcept;
157157

158158
/// <summary>
159159
/// Reset network state listener to uninitialized state

tests/functests/MultipleLogManagersTests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ using namespace MAT;
3939
class RequestHandler : public HttpServer::Callback
4040
{
4141
public:
42-
RequestHandler(int id) : m_count(0), m_id(id){}
42+
RequestHandler(int id) noexcept : m_id(id){}
4343

4444
int onHttpRequest(HttpServer::Request const& request, HttpServer::Response& /*response*/) override
4545
{
@@ -54,7 +54,7 @@ class RequestHandler : public HttpServer::Callback
5454
}
5555

5656
private:
57-
size_t m_count;
57+
size_t m_count {};
5858
int m_id ;
5959
};
6060

0 commit comments

Comments
 (0)