This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ dayly bug report] const_cast to rvalue of class type
- To: Gabriel dot Dos_Reis at sophia dot inria dot fr (Gabriel Dos_Reis)
- Subject: Re: [C++ dayly bug report] const_cast to rvalue of class type
- From: patrick <patrick at mail dot boxsoft dot com>
- Date: Fri, 30 Apr 1999 21:27:30 -3100 (PDT)
- Cc: egcs at egcs dot cygnus dot com (egcs list)
hi,
> patrick <patrick@mail.boxsoft.com> writes:
>
> | Sometime in the late 1900s it was said:
> |
> | OK. I may be in the dark here too. But afaik const_cast<T>( t )
> | will cast t to T exactly as (T)t would have iff T and the type
> | of t are different either in 'const' and 'volatile'. At least that
> | is what Bjarne Stroustrup confirms (as I paraphrased from his book).
>
> Exact citation please.
"The C++ Programming Language" 2nd Edition
Bjarne Stroustrup
ISBN 0-201-53992-6
page: 639, 3rd paragraph.
const_cast<T>(e) casts e to a T exactly as (T)e would have done
provided T and the type of e differ only in const and volatile
modifiers. Otherwise, const_cast<T>(e) is an error. Thus,
const_cast manipulates "constness" only and not other aspects
of type.
I'm not sure if this is what you wanted me to provide. I assumed
most everyone knew of Bjarne's work.
patrick@boxsoft.com