Assertion Error

Moritz Maxeiner via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 12 14:01:26 PDT 2017


On Tuesday, 12 September 2017 at 19:44:19 UTC, vino wrote:
> Hi All,
>
> I have a small piece of code which executes perfectly 8 out of 
> 10 times, very rarely it throws an assertion error, so is there 
> a way to find which line of code is causing this error.

You should be getting the line number as part of the crash, like 
here:

--- test.d ---
void main(string[] args)
{
	assert(args.length > 1);
}
--------------

-----------------
$ dmd -run test.d

core.exception.AssertError at test.d(3): Assertion failure
[Stack trace]
-----------------

If you don't what are the steps to reproduce?


More information about the Digitalmars-d-learn mailing list