You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For handling unexpected values, I would like an unconditional assertion for which a custom assertion handler can decide not to abort, i.e. one that is not annotated with [[noreturn]]. Something like:
enum_value ToEnum(std::uint8_t byte)
{
switch (value) {
case0x00: return enum_value::first;
case0x01: return enum_value::second;
}
UNEXPECTED(byte); // Like PANIC(byte) but can continue if the assertion handler does not abortreturn enum_value::unexpected;
}
I want to be able to crash in debug (to make it obvious during testing) but in release, report the value via the assertion handler and continue (to avoid crashing the app for users).
If this is something you'll be interested in as well, I can open a PR for that.
The text was updated successfully, but these errors were encountered:
Hi, thanks for opening this. I can see the use-case, though the best way to go about this is not entirely clear to me. I'm thinking of questions like does this require maybe-returning variants of both panic and assertions? How could this be clearly introduced without confusion? What would the failure handler interface look like? Maybe some sort of DEBUG_PANIC that's checked in debug and not in release is the solution here?
Hi and thanks for the amazing library!
For handling unexpected values, I would like an unconditional assertion for which a custom assertion handler can decide not to abort, i.e. one that is not annotated with
[[noreturn]]
. Something like:I want to be able to crash in debug (to make it obvious during testing) but in release, report the value via the assertion handler and continue (to avoid crashing the app for users).
If this is something you'll be interested in as well, I can open a PR for that.
The text was updated successfully, but these errors were encountered: