This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Will therefore GDB utilize C++ or not?
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Tom Tromey <tromey at redhat dot com>, gdb at sourceware dot org
- Date: Mon, 21 May 2012 18:52:52 +0200
- Subject: Re: Will therefore GDB utilize C++ or not?
- References: <20120330161403.GA17891@host2.jankratochvil.net> <87aa2rjkb8.fsf@fleche.redhat.com> <4F832D5B.9030308@redhat.com> <20120409190519.GA524@host2.jankratochvil.net> <4F833D29.4050102@redhat.com> <8762cwpz3u.fsf@fleche.redhat.com> <4FBA6D04.7060804@redhat.com>
On Mon, 21 May 2012 18:27:48 +0200, Pedro Alves wrote:
> and then:
>
> old_chain = make_cleanup (foo_cleanup, &whatever_arg);
>
> if (whatnot)
> {
> discard_cleanups (old_chain);
> return SUCESS;
> }
> do_cleanup (old_chain);
>
> But yes, as I've said before elsewhere, give me destructors,
> everything else I can live without. :-)
>
> Basically, whoever understands RAII should understand cleanups.
> Not counting the auto-destruction issue, I'm saying that writing
> raii classes vs writing cleanup function is mostly syntax sugar.
With RAII you do not have to write many times in that function that do_cleanup
statement (for multiple cleanup markers), which makes one of the differences.
Jan