Null references (oh no, not again!)
Joel C. Salomon
joelcsalomon at gmail.com
Thu Mar 5 09:23:55 PST 2009
Georg Wrede wrote:
> Jason House wrote:
>> I'll gladly add assert(0) if my complex logic confuses the compiler.
>> Actually, it pisses me off when the current dmd compiler complains
>> about an assert(0) being unreachable.
>
> I'd love it if an unreachable assert(0) were a special case.
>
> At the start of programming, the code is in serious flux, and many times
> it would be really handy to have a few extra asserts around. Once the
> code crystallises you remove the most blatant asserts.
Don’t be so quick to remove them; when you refactor your code you leave
yourself open to these same bugs biting you.
Remember “Can’t Happen or /* NOTREACHED */ or Real Programs Dump Core”
by Ian Darwin & Geoff Collyer
<http://www.literateprogramming.com/canthappen.pdf>.
—Joel Salomon
More information about the Digitalmars-d
mailing list