SHORT Re: Suggestion: "fix" assert(obj)

sambeau spam_sambeau at mac.com
Sat Jun 16 02:53:55 PDT 2007


Walter Bright Wrote:
> It's not only asserts done in hardware, it's asserts with:
> 
> 1) zero code size cost
> 2) zero runtime cost
> 3) they're there for every pointer dereference
> 4) they work with the debugger to let you know exactly where the problem is
> 
> Seg faults are not an evil thing, they're there to help you. In fact, 
> I'll often *deliberately* code them in so the debugger will pop up when 
> it hits them.

</lurk>
While I get your point completely I believe this style of debugging is only really useful to the hard-core professional.

For the novice, where the debugger is a scary place of last resort, it would be more useful to have an assert too. All most of us want is a line number: and segfaults don't give us that. 

If we also have an assert, hard-core programers can choose whether to assert or segfault, surely?.
<lurk>



More information about the Digitalmars-d mailing list