With this change, developers can take the marisa library without being forced to enable exceptions for their whole library / application by using "-fexceptions". However, some projects decide to not to enable exceptions.
The reason that we have to enable exceptions for the whole application/library is that the marisa library throws exceptions in header files. If we don't enable exceptions, there will be two implementations of those functions that throw. This violates the ODR.
There are only two places where we throw exceptions from header files in non-debug mode.
IMO, it might be reasonable to use MARISA_DEBUG_IF there instead of MARISA_THROW_IF.
Also, I think the new behavior is also closer to unique_ptr::reset.
From cppreference:
A test for self-reset, i.e. whether ptr points to an object already managed by *this, is not performed, except where provided as a compiler extension or as a debugging assert.
MARISA_DEBUG_IF is like the debugging assert that it mentions.
Hi folks
With this change, developers can take the marisa library without being forced to enable exceptions for their whole library / application by using "-fexceptions". However, some projects decide to not to enable exceptions.
The reason that we have to enable exceptions for the whole application/library is that the marisa library throws exceptions in header files. If we don't enable exceptions, there will be two implementations of those functions that throw. This violates the ODR.
There are only two places where we throw exceptions from header files in non-debug mode. IMO, it might be reasonable to use MARISA_DEBUG_IF there instead of MARISA_THROW_IF.
Also, I think the new behavior is also closer to unique_ptr::reset. From cppreference:
MARISA_DEBUG_IF is like the debugging assert that it mentions.
What do you think?
Thanks!