Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-08-06 13:28:03


From: Daryle Walker <darylew_at_[hidden]>
> on 8/20/01 12:02 AM, Greg Colvin at gcolvin_at_[hidden] wrote:
>
> [SNIP]
> > And finally, the Core group "broke" auto_ptr in Tokyo, so we also
> > need a core language change to make it work as designed. If we
> > can't get that change we need to fix the specification to fit
> > reality, or perhaps specify auto_ptr in terms of semantics with
> > no mention of auto_ptr_ref, and tell implementers to just "make
> > it so".
> [TRUNCATE]
>
> What did the Core group do, and why is it considered a "break"?

I put "broke" in quotes, as what they did was on the edge
between "breaking" and "refusing to fix". In brief, Bill
Gibbons' rescued auto_ptr at the last moment by coming up
with a very clever implementation to allow the auto_ptr
to have it's bizzare copy semantics by using (some say
abusing) some obscure loopholes in the language.

After struggling for years, Steve Adamczyk failed to find
a way to make the EDG compiler handle line 16 below, and
the committee decided that the language should not support
the loophole that was needed to make it work.

#include <memory> // 1
struct Base { // 2
   static void sink(auto_ptr<Base>); // 3
}; // 4
struct Derived : Base { // 5
   static void sink(auto_ptr<Derived>); // 6
}; // 7
auto_ptr<Derived> source() { // 8
   auto_ptr<Derived> p(source()); // 9
   auto_ptr<Derived> pp(p); // 10
   Derived::sink(source()); // 11
   p = pp; // 12
   p = source(); // 13
   auto_ptr<Base> q(source()); // 14
   auto_ptr<Base> qp(p); // 15
   Base::sink(source()); // 16
   q = pp; // 17
   q = source(); // 18
   return p; // 19
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk