halt with optional message?

simendsjo simendsjo at gmail.com
Thu Aug 11 06:58:44 PDT 2011


On 11.08.2011 14:56, Vladimir Panteleev wrote:
> On Thu, 11 Aug 2011 14:59:03 +0300, Vladimir Panteleev
> <vladimir at thecybershadow.net> wrote:
>
>> I don't see what the problem is. Is your program buggy? Don't use
>> -release. Are you done fixing bugs? Use -release to remove pointless
>> clutter. Is the program segfaulting on a user's PC? Send him a debug
>> build!
>
> By the way, I'd like to add some thoughts on how wrong I think it is to
> rely on a single debugging feature like this in release builds. Asserts
> (both conditional and unconditional), contracts, invariants and native
> language features such as array bounds checking all work together to
> find bugs as soon as possible. If you get an error message on an
> assert(0) and you attempt to debug it from that, you may be led on a
> wild goose chase, because the program might have actually failed much
> earlier and ran for a while in an undetermined state, corrupting memory
> left and right or spreading internal state inconsistencies uncaught by
> invariants. I know about this all too well from my experience of
> debugging memory corruption - the garbage collector is compiled with no
> invariants as its performance is critical, but recompiling my program
> with a version of Phobos with contracts enabled would have saved me
> tracing a few steps to find the source of corruption.
>

Which reminds me.. Why isn't a phobos shipped with a precompiled version 
containing contracts?


More information about the Digitalmars-d mailing list