[C++-sig] Re: [Implementation] Calling wrapped functions, converters, policies

David Abrahams dave at boost-consulting.com
Fri Sep 19 16:57:47 CEST 2003


"Niall Douglas" <s_sourceforge at nedprod.com> writes:

> On 18 Sep 2003 at 17:33, David Abrahams wrote:
>
>> > GCC-XML is broken in some areas, but I'm sure its bugs will be fixed
>> > with time. My only concern is that GCC is overly conservative in its
>> > interpretation of the C++ standard - code which MSVC permits (and I
>> > would permit) GCC barfs on.
>> 
>> Actually it's the opposite.  Those areas where GCC restricts what you
>> can do but MSVC does not are not open to interpretation: GCC gets it
>> right and MSVC gets it wrong.  In fact, in some of the areas where
>> different interpretations of the standard are possible (e.g. Koenig
>> Lookup), GCC is IMO far too liberal, which breaks otherwise correct
>> code.
>
> I think one can approach this from both angles then. I personally had 
> found GCC to barf on code MSVC7.1 is happy with, but then I write and 
> debug on MSVC7.1 first and then compile on GCC. If you tend to go the 
> other way round, you'd probably find it the other way.
>
> My main bugbear with GCC is it forces const temporaries. This makes 
> destructive copy construction semantics severely castrated, so much 
> so you usually must #ifdef hack in a copy constructor taking a const 
> reference just on GCC :(
>
> I know all the usual arguments about temporaries should be const. I 
> strongly disagree. 

Disagree all you want.  A C++ compiler should conform to the standard
or it isn't C++.  Which compiler is correct in this regard is not open
to debate.

> C++ is all about giving plenty of rope to the programmer to hang
> themselves with 

<opinion>
Au contraire, it's about providing abstraction with safety and
performance.
</opinion>

> where that rope /could/ be used for something useful and no other
> better way is available for doing it. And destructive copy
> construction is clearly implied when it takes a non-const reference.

Maybe you would be interested in a proposal I co-authored:
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1377.htm

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list