I was surprised to find out that JUCE assertions (
jassert) only trigger a crash when attached with a debugger. I’d like debug builds to informatively crash on assertion failures even when a debugger is not attached. This would allow in-house testers to run Debug builds which crash on assertions failure without requiring them to attach a debugger (the testers might not even have a development environment installed).
assert already works this way, and calls
abort() in debug builds regardless of whether a debugger is attached.
If you agree this is something useful to have, I can think of three options:
- Just change the existing behavior so that
jassertalways aborts in debug builds, not just when a debugger is attached.
- Same as 1 but add an opt-out macro to revert to the existing behavior (only crash on failed assertion under debugger).
- Add an opt-in macro to turn on the new suggested behavior.
I had thought option 1 is the best, since if you have have debug builds which fail assertions, it’s better they trigger a crash than silently fail. Then I noticed a failed
jassert outputs a log without crashing in debug builds, and maybe that’s a behavior that would sometimes be useful, although probably less often. So now I think option 2 makes the most sense.