Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2002-10-07 11:49:12


David Abrahams wrote:
>
> Daniel Frey <daniel.frey_at_[hidden]> writes:
>
> >
> > I'm still interested in an example where it fails, as all real-world
> > code works fine for me :)
>
> Why not just use static_cast through void*, since that not only works
> in the real world but is guaranteed to work according to the standard?

Is it? As far as I understand the problem, it makes no difference - if I
use static_cast, the same problems could occur. The underlying problem
with casts is always the same: You tell the compiler that you know
better. You actually have to force the compiler to accept an object of
type X as type Y and I can't see how static_cast could be any
better/different than reinterpret_cast here. Indeed I had some problems
with static_cast creating temporary objects - which is what I definitely
don't intended - when playing with my pointer class. If you have some
insight about why static_cast could do better than reinterpret_cast
here, I'd be happy if you share your wisdom with me. :)

Regards, Daniel

--
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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