This is the mail archive of the
gdb-patches@sourceware.org
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: <1474949330-4307-1-git-send-email-tom@tromey.com> <1474949330-4307-3-git-send-email-tom@tromey.com> <20160927085937.com7c7ct4wuchzpg@ball> <f5480fcd-f0d1-2881-9b4a-3744b81efa2b@redhat.com> <87wphtfmcj.fsf@tromey.com> <579b45a0-2393-bda9-a244-cb2f7611635f@redhat.com> <87k2dsg1ul.fsf@tromey.com> <87fuogg0jr.fsf@tromey.com> <01d6497c-7421-d234-e5b3-60a825b43c36@redhat.com>
>>>>> "Pedro" == Pedro Alves <palves@redhat.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.
Tom