Handle assertions as runtime errors

This commit is contained in:
momo5502 2022-04-05 18:17:29 +02:00
parent 970c9571b2
commit 1f986d5588
2 changed files with 16 additions and 0 deletions

View File

@ -1,5 +1,17 @@
#pragma once #pragma once
#ifdef ASSERT
#undef ASSERT
#endif
#define ASSERT( exp ) if(!(exp)) throw std::runtime_error("Assertion failed: " STRINGIFY(exp))
#ifdef NT_ASSERT
#undef NT_ASSERT
#endif
#define NT_ASSERT( exp ) ASSERT( exp )
namespace std namespace std
{ {
class exception class exception

View File

@ -8,6 +8,10 @@
#include <ia32.hpp> #include <ia32.hpp>
#pragma warning(pop) #pragma warning(pop)
#define STRINGIFY_(a) #a
#define STRINGIFY(a) STRINGIFY_(a)
#include "stdint.hpp" #include "stdint.hpp"
#include "nt_ext.hpp" #include "nt_ext.hpp"
#include "new.hpp" #include "new.hpp"
#include "exception.hpp"