Venturecxx icon indicating copy to clipboard operation
Venturecxx copied to clipboard

Increase politeness of C++ asserts

Open axch opened this issue 9 years ago • 2 comments

When a C++ assert fails, the user sees the location and message (if any), and "Aborted (core dumped)". No stack trace; no ability for an enclosing Python wrapper to recover. throw behaves better -- it turns into a RuntimeException on the Python side, which is worth at least some context.

I am generally of the opinion that asserts should either be eliminated entirely because of this unfortunate behavior, or restricted to situations that represent bugs in Venture as opposed to bugs in user programs. And those that remain should have meaningful messages.

git grep indicates 375 asserts in Puma. Someone^TM ought to audit them in light of this desired policy.

axch avatar Mar 04 '16 19:03 axch

asserts should absolutely be restricted to situations that represent bugs in Venture. Abusing assert for any other purpose is itself a bug.

riastradh-probcomp avatar Mar 04 '16 20:03 riastradh-probcomp

Perhaps this could be viewed as a code style issue and thus linked to #429.

axch avatar May 11 '16 23:05 axch