Disable exceptions if a specific macro is defined
Closed this issue · 1 comments
Currently, Glaze will disable exceptions if __cpp_exceptions
is not defined. However, __cpp_exceptions
is a built-in macro and cannot be undefined by the user. This makes it impossible to disable exceptions/RTTI for Glaze only. One solution is to add some macro like GLAZE_NO_EXCEPTIONS
to control this, and replace
#if __cpp_exceptions
to
#if __cpp_exceptions && !defined(GLAZE_NO_EXCEPTIONS)
Sorry, I misunderstood the problem. Using Glaze will add RTTI to the binary. I thought it's because Glaze uses exceptions somewhere, but it turns out it's because the use of std::function
in Glaze. In MSVC, std::function
will introduce static RTTI even RTTI is disabled by /GR-
. The solution is to define _HAS_STATIC_RTTI=0
, acoording to Lambdas always have debug information in release mode - Developer Community. So it's not really a problem of Glaze.