Topic: aside about casting away constness (was delete of const objects o.k.?)
Author: "Darin Adler" <darin@bentspoon.com>
Date: 1999/09/15 Raw View
James.Kanze@dresdner-bank.com wrote:
> According to 5.2.9/6: "The inverse of any standard conversion sequence,
> other than the lvalue-to-rvalue, array-to-pointer, function-to-pointer, and
> boolean conversions, can be performed explicitly using static_cast subject
> to the restriction that the explicit conversion does not cast away
> constness." [...] (As an aside, I wonder whether the standard isn't missing
> something about casting away volatile, as well. int* to volatile void* is
> legal, but I hope that static_cast< int* >( volatile void* ) isn't.)
In response to your aside: The standard is OK.
Section 5.2.11 defines (in paragraphs 8-12) "casting away constness".
The definition includes casting in ways that remove volatile as well.
-- Darin
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]