This is the mail archive of the
mailing list for the GDB project.
Re: [OB] Add cleanup, source.c
> From: "Michael Snyder" <email@example.com>
> Cc: "Michael Snyder" <Michael.Snyder@access-company.com>, <firstname.lastname@example.org>
> Date: Fri, 29 Jun 2007 13:34:05 -0700
> > We're both right. Cleanups do get discarded, and cleanups that aren't
> > discarded are called at the top level. Every cleanup I've written
> > since I started working on GDB at 2001 has been freed locally rather
> > than at the top level, though. I think it's very confusing if the
> > cleanups are not locally paired.
> > From gdbint.texinfo:
> > Your function should explicitly do or discard the cleanups it
> > creates. Failing to do this leads to non-deterministic behavior since
> > the caller will arbitrarily do or discard your functions cleanups.
> > This need leads to two common cleanup styles.
> Yeah, that text was written by Andrew in 2003. Before that we
> had some text written by Eli in about 2001, also saying that you
> should call do_cleanups.
> Don't mean to be a curmudgeon, but I go back way before that. ;-)
> Here's how version 1.1 of the document read:
Sorry, I'm confused: where exactly is the current gdbint.texinfo text
Are you saying that the non-deterministic behavior mentioned in the
manual is a red herring? But the explanation it provides (the fact
that some other function further on could discard_cleanups) seems to
provide valid basis for that, doesn't it?