This is the mail archive of the
mailing list for the GDB project.
Re: [OB] Add cleanup, source.c
> > > 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.
> > <ahem>
> > 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?
Depends on what the "cleanups" are, I suppose. Those I'm familiar
with are mostly xfrees, fcloses, etc. Doesn't really matter what
order they are performed in, so long as they get done before the
next command loop cycle.
Can you give me an example of such non-deterministic behavior?