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

Deewiant deewiant.doesnotlike.spam at gmail.com
Sat Jun 16 12:40:31 PDT 2007


Walter Bright wrote:
> sambeau wrote:
>> 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.
> 
> They do when combined with symbolic debug info - that is how the
> debugger is able to display your source code with the highlighted line
> where it seg faulted.
> 

Yes, but you still need the debugger to see it. The fact remains that many
novices and stubborn professionals don't use debuggers, no matter how useful
they are and how many times they are praised by others. They're happy with their
printf debugging, even though they would probably be happier using a debugger,
at least in some cases.

The situation is a lot like that of many C++ zealots who would like D a lot but
simply refuse to try it for some reason or other. Invalidate that reason and you
get more users.

In this case, either remove all asserts and force everyone to use a debugger in
all cases, or add some asserts to make people generally happier and more
productive when coding.

Personally, I find it annoying that most crashing bugs I can catch easily with a
normal run of the program, but when it's "Access Violation" or "Win32 Exception"
or "Segmentation fault", I have to recompile with -g and fire up the debugger to
find out exactly what happened and where.

(OT: A similar case could be made for the Phobos call stack backtracing patch.)

-- 
Remove ".doesnotlike.spam" from the mail address.



More information about the Digitalmars-d mailing list