Date: 2000-08-01 04:59:07
> The reinterpre_cast is ugly and causes undefined behaviour since
> isn't a POD, but I'd bet it will work in practice.
> What is proposed is bugware (ie, having the wrong behaviour
> behaviour) because someone else had the wrong behaviour (not
> standard C++)). Bugware is generaly bad; here I think it is the
> solution because another simplier and working solution is already in
> make everything public.
Gee, what a lively discussion - I hadn't expected that :-)
I'm fully aware that my proposal is ugly, but the code would be
encapsulated by a macro that effectivly stated that this code would
only be compiled when using a non-conforming (and therefore already
buggy) compiler. Plus, the external interface of the class would be
the one we originally designed, without having to sacrifice
:-) Now we already know which compiler we're targeting, so we can as
well prove that the "undefined behaviour code" does produce
predictable results with that one compiler. In my case, the
reinterpret_cast could only fail if the compiler created different
class layouts for different instantiations of "shared_ptr", which it
doesn't do because the rest of the code alreaday guarantees
compatibility between the pointer types.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk