This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13484] Addition of -fenable-msvc-relaxations option
- From: "s_gccbugzilla at nedprod dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Dec 2003 21:32:14 -0000
- Subject: [Bug c++/13484] Addition of -fenable-msvc-relaxations option
- References: <20031224024633.13484.s_gccbugzilla@nedprod.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From s_gccbugzilla at nedprod dot com 2003-12-24 21:32 -------
Whoah, some of those replies were really aggressive :(. I get the hint - there
is no scope for disobeying the ISO C++ standard whatsoever. It's your software,
so cool - it was just an idea.
To answer some of the assorted raised points, I had originally asked for some
pointers about the typing system implementation so I could generate the patch -
I didn't want anyone to do it for me. I feel this extension would benefit a lot
of people, so I'm willing to contribute the work.
The move constructor C++ standard extension was submitted by Dave Abrahams, it
allows eg;
class Type
{
Type(const Type &other); // copy constructor
Type(Type &&other); // move constructor
};
This would be a great boon for objects which need to be passed around by value
but only one instance makes sense ie; destructive copies only. As I mentioned
before, it's done in MSVC using a non const reference copy constructor. It would
also be a boon for optimisation as the compiler could select the move
constructor when the source is about to get destroyed anyway eg; string classes.
For real world code, seeing as the patch wouldn't be accepted anyway, I won't
bother. Suffice it to say it's a useful idiom and it allows a better mapping of
class types to the real world. MSVC relaxes it here because MFC uses it.
Cheers,
Niall
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13484