[OT] Which IDE / Editor do you use?

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Sat Sep 14 17:09:53 PDT 2013


On Sat, 14 Sep 2013 19:38:10 +0200
"Adam D. Ruppe" <destructionator at gmail.com> wrote:

> On Saturday, 14 September 2013 at 17:31:32 UTC, H. S. Teoh wrote:
> > I'm pretty sure this is possible with a little effort.
> 
> beat you to it!
> http://forum.dlang.org/thread/fxuwovrirseuatzeeprb@forum.dlang.org?page=17#post-jxqobgridgweioqclfqr:40forum.dlang.org
> 
> > One trick my coworkers like to use sometimes (with C/C++) is to 
> > insert an infinite loop into the program at the suspected 
> > problem spot, then at runtime when it reaches 99% CPU
> 
> In D, I like to just sprinkle assert(0)'s in places. It actually 
> works pretty well - you can do a binary search of even a fairly 
> large codebase in just a few iterations, then fix up the asserts 
> to actually check what went wrong, and then keep them there later 
> to form sanity checks or unit tests to catch regressions after 
> the bug is fixed.
> 

Assert? That doesn't let you trace the flow. I use this:

void trace(string file=__FILE__, size_t line=__LINE__)(string
msg="trace") {
        writefln("%s(%s): %s", file, line, msg);
        stdout.flush();
}

Usage:

trace();
foo();
trace();
bar();
trace("-END-");

Output:

file.d(1): trace
file.d(3): trace
file.d(5): -END-

For variable watching, I do this:

// Using:
<https://bitbucket.org/Abscissa/semitwistdtools/src/c7f89f7cd2c086591b544d5bffc536827ae6f763/src/semitwist/util/mixins.d?at=master#cl-103>
auto foo = 17;
mixin(traceVal!"foo");

Output:
foo: 17

I haven't found a way to elimate the "mixin(" part of that one
though, which limits its convenience :(



More information about the Digitalmars-d mailing list