From 97b60f5cb93aa2f063a8708f9247bb38b6be281e Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 5 Sep 2022 18:53:25 +0200 Subject: [PATCH] fix reserved macro, reorder members, adds virtual destructor --- exceptions/exceptions.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/exceptions/exceptions.h b/exceptions/exceptions.h index 021a989..5596974 100644 --- a/exceptions/exceptions.h +++ b/exceptions/exceptions.h @@ -1,5 +1,6 @@ -#ifndef __EXCEPTIONS_H__ -#define __EXCEPTIONS_H__ +#pragma once +#ifndef EXCEPTIONS_H +#define EXCEPTIONS_H #include #include @@ -35,8 +36,6 @@ class Exception : public std::exception { protected: - //! Name of the current exception class - std::string name; //! Description of the exception std::string description; @@ -50,6 +49,9 @@ protected: //! Line where the exception has been raised int line; + //! Name of the current exception class + std::string name; + //! Assembled message std::string message; @@ -71,7 +73,7 @@ public: } //! The destructor is not allowed to throw exceptions - virtual ~Exception() throw () {} + virtual ~Exception() noexcept {} //! The method to use for printing the complete description of the exception const char* what() const noexcept @@ -80,5 +82,5 @@ public: } }; -#endif // __EXCEPTIONS_H__ +#endif // EXCEPTIONS_H