Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-09-20 11:27:20

"David Abrahams" <dave_at_[hidden]> wrote in message
> Richard Hadsell <hadsell_at_[hidden]> writes:
> > Jonathan Turkanis wrote:
> >
> >>When I was writing it I initially typed 'const_cast', but then thought to
> >>myself: why use my big guns if I don't have to? ;-)
> >>
> > For clarity -- to tell the reader that you intended to modify the
> > const-ness.
> static_cast is a bigger gun than const_cast. At least const_cast
> cant violate data layout, and unless there is actually a constant
> object, won't result in undefined behavior.

Good point. I guess part of the reason I avoid const_cast whenever possible is
that people look upon it suspiciously, even if it's only adding
cv-qualification. Maybe people should be more suspicious of static_cast.


Boost list run by bdawes at, gregod at, cpdaniel at, john at