Thoughts about D
Richard Delorme
abulmo at club-internet.fr
Sun Dec 3 07:29:22 UTC 2017
On Saturday, 2 December 2017 at 23:44:39 UTC, Walter Bright wrote:
> On 12/2/2017 4:38 AM, Iain Buclaw wrote:
>> But then you need to bloat your program with debug info in
>> order to
>> understand what, why, and how things went wrong.
>
> Most of the time (for me) that isn't necessary, because the
> debugger still shows where it failed and that's enough.
>
> Besides, you can always rerun the test case with a debug build.
+1
To me, the current D assert is useless, and I prefer to use a
C-like equivalent, that "crash" the program without unwinding the
stack. Then I can inspect the cause of the crash on a debugger,
with access to the current context (variable contents, etc.), is
it from a (core file) or by running the program on the debugger.
That way I do find the bug(s) much faster. More generally
treating errors (ie bugs) as unrecoverable exceptions is a
mistake in IMHO. I prefer a call to the C function abort() that
leaves the context intact.
More information about the Digitalmars-d
mailing list