[dmd-internals] Asserts

Leandro Lucarella luca at llucax.com.ar
Sun Nov 11 04:41:54 PST 2012


David Held, el  9 de November a las 22:41 me escribiste:
> On 11/9/2012 10:17 PM, Jonathan M Davis wrote:
> >[...]
> >Logging is extremely useful for applications which are constantly up and/or
> >which involve a lot of network traffic or user interaction (which is typically
> >non-repeatable and often can't be examined with the debugge running). However,
> >that doesn't apply at all to a compiler. Compilers are incredibly
> >deterministic, and errors are very, very repeatable. All you have to do is run
> >the compiler on the same input, and you'll see the problem again, and stopping
> >the compiler in a debugger causes no problems. So, I'd say that logging is
> >completely inappropriate for a compiler.
> 
> If there were no logging statements in the compiler, you might have
> a point.  The fact that the dmd source is littered with them puts
> the lie to your insistence that they are "inappropriate". Obviously,
> Walter found them very useful at times.
> 
> Also, the compiler is only deterministic because it isn't yet
> multi-threaded.  That doesn't mean Walter hasn't attempted to make
> it such on more than one occasion.  If the compiler had more
> immutable data structures, this would probably be an easier effort.
> ;)
> 
> Finally, what the debugger cannot do is provide you with a history
> of what happened, except insofar as you are willing to manually
> capture the state change of various memory locations as you step
> through the program.

Well, then I guess you don't know gdb's reverse debugging :D
http://sourceware.org/gdb/news/reversible.html

Is limited though (no reverse debugging of programs using threads for exapmle),
just wanted to point that out as a curiosity :). I agree is always better to
catch NULL values as soon as possible.

-- 


More information about the dmd-internals mailing list