How to catch line number of exception without catching it ?

codephantom me at noyb.com
Thu Dec 14 01:34:56 UTC 2017


On Wednesday, 13 December 2017 at 18:24:09 UTC, Thomas wrote:
> Or is there a better solution for tracing the error position 
> from root till the branch ?
>

Speaking of tracing exceptions, here's my favourite one .. so far 
;-)
(I mean come on.. debugging is great fun!)

btw. If you compile/run this code on Windows, using LDC, you'll 
get a nice little beep from the speaker (when it runs).

// ------------
module test;

import std.stdio;

void main()
{
     auto str = "hello";
     string * ptr = &str;
     writeln(ptr[1]);   //compile without using the -O option
     // writeln(ptr.ptr[1]); // the above line was meant to be 
this line.
}
// ------------


More information about the Digitalmars-d-learn mailing list