On Sunday 13 March 2005 02:07, James E Wilson wrote:
> Richard Stallman wrote:
> > Currently, I believe, GCC combines various calls to abort in a single
> > function, because it knows that none of them returns.
>
> To give this request a little context, consider the attached example.

May I recommend KMail, the mailer that complains when you say you
attached something, and you didn't?  :-)

> Otherwise, we need to consider the merits of disabling an optimization
> to make debugging easier.  This is a difficult choice to make, but at
> -O2, I'd prefer that we optimize, and suggest other debugging techniques
> intead of relying on the line numbers of abort calls.  Such as using
> assert instead.

Right.  Really, abort() is just the wrong function to use if you
want to know *where* a problem occured.  GCC uses this fancy_abort
define:

system.h:#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)

where fancy_abort() is a, well, fancy abort that prints some more
information about what happened, and where.  IMVHO any moderately
large piece of software that uses abort should consider using this
kind of construct, or use assert().  Crippling optimizers around
abort is just silly.  It's attacking a real problem from the wrong
end.  The real problem is that abort() is just not detailed enough.

Gr.
Steven

Reply via email to