Skip to content

Commit

Permalink
Fix: /EHc effect on exceptions in MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Apr 29, 2024
1 parent 48ef5e8 commit d1be7d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/usearch/index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@

extern "C" {
/// @brief Helper function to simplify debugging - trace just one symbol - `__usearch_raise_runtime_error`.
/// Assuming the `extern C` block, the name won't be mangled.
inline static void __usearch_raise_runtime_error(char const* message) {
#ifndef __cpp_exceptions
// On Windows we compile with `/EHc` flag, which specifies that functions
// with C linkage do not throw C++ exceptions.
#if !defined(__cpp_exceptions) || defined(USEARCH_DEFINED_WINDOWS)
std::terminate();
#else
throw std::runtime_error(message);
Expand Down

0 comments on commit d1be7d5

Please sign in to comment.