diff options
| author | batsumaru <> | 2026-08-10 19:27:13 +0900 |
|---|---|---|
| committer | batsumaru <> | 2026-08-10 19:27:13 +0900 |
| commit | 8918325808f9e474c473f4e1c1b4e4e73b8187cf (patch) | |
| tree | 74628a2a1a7e28baa303484f968fa9aae9e242ca /include/fatal_error.h | |
| parent | 1fe44b8855c0e83c443e8cbaeeedf25fbe342849 (diff) | |
Fixed casting, added fatal error
Diffstat (limited to 'include/fatal_error.h')
| -rw-r--r-- | include/fatal_error.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/fatal_error.h b/include/fatal_error.h new file mode 100644 index 0000000..06e1b88 --- /dev/null +++ b/include/fatal_error.h @@ -0,0 +1,16 @@ +#ifndef FATAL_ERROR_H +#define FATAL_ERROR_H + +#include <format> +#include <cstdlib> +#include <cstdio> + +template <typename... Args> +[[noreturn]] void fatal_error(std::format_string<Args...> fmt, Args&&... args) { + std::string msg = std::format(fmt, std::forward<Args>(args)...); + std::fputs(msg.c_str(), stderr); + std::fputc('\n', stderr); + std::abort(); +} + +#endif |
