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 18:30:26 -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 18:30 -------
Firstly to answer pinskia's point, from my understanding const temporaries are
not specified absolutely by the ISO C++ standard - it appears to be one of
interpretation (I don't have an up to date copy myself to check though). It's
also a very sore bone of contention as searching google shows because a LOT of
MSVC based code just won't compile on GCC and all the GCC people say "tough,
that's the standard".
I personally feel that's particularly unhelpful for two reasons: (i) This
position is a particular *interpretation* of the standard and (ii) like it or
not, a hell of a lot of code is written for MSVC first - compilers are /tools/
first before all else. When Symbian and GCC-XML based development relies so
heavily on MSVC and GCC working similarly, it is a sign of the great strength of
the open source philosophy that one can say "yes, we can interoperate".
Especially if it's like five lines of extra code in G++ with no maintainence
cost!
To answer giovannibajo, here's something from my own code (as small as possible)
:
class dllHandle
{
dllHandle(); // private constructor as dllOpen() is a friend
public:
dllHandle(dllHandle &other); // move constructor
};
static dllHandle FXProcess::dllOpen(const char *dllname);
static void FXProcess::dllResolve(const dllHandle &h, const char *symbol);
static void FXProcess::dllFree(dllHandle &h);
Here we have an ideal case of why move constructors are so useful. Yes, the ISO
C++ standard will get them eventually. However before then lots of MSVC people
are using non-const copy constructors in their code to implement a move
constructor.
Now try porting that to GCC. Answer is you can't unless you make the contents of
dllHandle all mutable which defeats the point of const.
As I said before, for such a small *optional* addition to GCC you greatly
improve its interoperability with MSVC. Which is the world's most popular C++
compiler. Which has substantial benefits for Symbian development as well as
GCC-XML.
Cheers,
Niall
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|WONTFIX |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13484