summaryrefslogtreecommitdiffhomepage
path: root/dev/crt/base_exception.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'dev/crt/base_exception.hxx')
-rw-r--r--dev/crt/base_exception.hxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/dev/crt/base_exception.hxx b/dev/crt/base_exception.hxx
new file mode 100644
index 00000000..9d3fd208
--- /dev/null
+++ b/dev/crt/base_exception.hxx
@@ -0,0 +1,35 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <crt/defines.hxx>
+
+/// @brief CRT exit, with exit code (!!! exits all threads. !!!)
+/// @param code
+/// @return
+extern "C" int __exit(int code);
+
+/// @brief Standard C++ namespace
+namespace std
+{
+ inline void __throw_general(void)
+ {
+ __exit(33);
+ }
+
+ inline void __throw_domain_error(const char* error)
+ {
+ __throw_general();
+ __builtin_unreachable(); // prevent from continuing.
+ }
+
+ inline void __throw_bad_array_new_length(void)
+ {
+ __throw_general();
+ __builtin_unreachable(); // prevent from continuing.
+ }
+} // namespace std