This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GDB to C++ issue: deletion


On Fri, Aug 01, 2008 at 04:34:33PM +0300, Eli Zaretskii wrote:
> > Date: Fri, 1 Aug 2008 08:51:24 -0400
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: gdb-patches@sourceware.org
> > 
> > For what it's worth, that's not my experience at all.  Contributors
> > have a lot of trouble with the GDB code.  One of the biggest problems
> > is cleanups
> 
> What are the problems with cleanups?  Do you mean the code that uses
> them or their implementation?

I mean the code that uses them; people working in other areas of GDB
rarely have to worry about their implementation.  Some areas I've
seen problems with:

It's not clear locally (i.e. looking at any bit of code that uses
cleanups) when or how the cleanups are executed.  They're usually
triggered by an exception from some called function, and the code that
invokes the cleanups is far away.  In C, people do not expect
exceptions and so they're confused by the introduction of exception
handling.

Similarly, it's rarely clear when a cleanup is necessary and when it
isn't.  We don't have any strong conventions on what functions can
throw.  So I often have to explain to people how to write cleanups
and why they need to.

Sometimes we run cleanups and sometimes we discard them.  This is
confusing.  It's not something that would be necessarily affected by a
change in language but use of an OO language might make it easier to
represent.  I believe discard_cleanups is usually used to implement
move semantics - a change in ownership from local to global without
copying.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]