This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13484] Addition of -fenable-msvc-relaxations option


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]