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.
This commit is contained in:
Matthew Koscumb 2024-02-05 10:30:57 -08:00 коммит произвёл GitHub
Родитель 8e3697de26
Коммит a5bd5a6ee3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -330,7 +330,7 @@ namespace MAT_NS_BEGIN
return true;
}
bool NetworkDetector::RegisterAndListen()
bool NetworkDetector::RegisterAndListen() noexcept
{
// ???
HRESULT hr = pNlm->QueryInterface(IID_IUnknown, (void**)&pSink);

Просмотреть файл

@ -153,7 +153,7 @@ namespace MAT_NS_BEGIN
/// Register and listen to network state notifications
/// </summary>
/// <returns></returns>
bool RegisterAndListen();
bool RegisterAndListen() noexcept;
/// <summary>
/// Reset network state listener to uninitialized state

Просмотреть файл

@ -39,7 +39,7 @@ using namespace MAT;
class RequestHandler : public HttpServer::Callback
{
public:
RequestHandler(int id) : m_count(0), m_id(id){}
RequestHandler(int id) noexcept : m_id(id){}
int onHttpRequest(HttpServer::Request const& request, HttpServer::Response& /*response*/) override
{
@ -54,7 +54,7 @@ class RequestHandler : public HttpServer::Callback
}
private:
size_t m_count;
size_t m_count {};
int m_id ;
};