This is the mail archive of the
mailing list for the GDB project.
Re: [RFA 02/22] Use RAII to save and restore scalars
- From: Tom Tromey <tom at tromey dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Tom Tromey <tom at tromey dot com>, Trevor Saunders <tbsaunde at tbsaunde dot org>, gdb-patches at sourceware dot org
- Date: Sun, 02 Oct 2016 11:11:07 -0600
- Subject: Re: [RFA 02/22] Use RAII to save and restore scalars
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com> <firstname.lastname@example.org> <20160927085937.com7c7ct4wuchzpg@ball> <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
>>>>> "Pedro" == Pedro Alves <email@example.com> writes:
>> However, once you need a copy constructor, it doesn't seem possible
>> without a move constructor. The issue is that a copy constructor take a
>> const reference, so you can't modify the fields of the original.
Pedro> You can -- make the fields mutable.
Ok, yeah, I had thought of this, but it seemed pretty ugly to me.
Instead I removed all the 2 argument forms in favor of a second explicit
assignment. This solves the problem as well.
I can go back and do the mutable thing if you really prefer it though.
Pedro> The gist is that I think that the features supported by compilers that
Pedro> people are using in practice to build gdb with is what matters
Pedro> in the end, not really C++03 vs C++11.
The issue I see is that it's just too easy otherwise for C++11isms to
slip in, especially considering that everybody doing development is
likely to be using a compiler with all the C++11 features. Maybe
buildbot can do C++03 builds to check.