dmd -betterC

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 21 03:51:39 PDT 2017


Kagamin wrote:

> On Wednesday, 21 June 2017 at 06:21:37 UTC, ketmar wrote:
>> but refusing to generate such strings for *all* code
>
> They are not useful enough for that, in 99% of cases location of assert 
> is enough to know what's wrong, when it isn't, the string is not going to 
> tell where it went wrong, so you need to debug it, in which case there's 
> no difference again.

there, of course, *IS* The difference. besides the aesthetical one (seeing 
failed condition immediately "clicks" in your head, and generic "assertion 
failed" message is only frustrating), there may be the case when source 
code changed since binary was built. here, line number gives you zero 
information, and you have to checkout that exact version, and go check the 
line. but when failed condition dumped, most of the time it allows you to 
see what is wrong even without switching to the old codebase (yes, "most of 
the time" is from RL -- it is literally *most* of the time for me, for 
example).


> Don't fluent asserts already do what you want? See 
> http://fluentasserts.szabobogdan.com/

nope. those aren't assertions at all, compiler cannot even remove 'em with 
"-release" flag (not that i'm using it much, but still no, thanks).

mind you, assertions is not only for unittesting.


More information about the Digitalmars-d mailing list