On Fri, 21 May 2004 23:44:08 GMT, Jake Montgomery
<> wrote:
>
>I dont know if this sheds any light on why MS would have such a language
>extension, but you can use a similar cast on an lvalue in VC7.1 with
>language extensions on.
>
>const int c = 4;
>int n = 5;
>volatile int v = 6;
>
>(const int)n = 6; // Fine in VC 7.1 with extensions
>(int)v = 3; // Fine in VC 7.1 with extensions
>
>(int)c = 3; // illegal
>(unsigned int)n = 7; // illegal
>
Yup, that's consistent with my "pet theory" in my reply to Minti above:
this language extension allows a cast to serve as a type modifier on the
actual lvalue operand, rather than necessarily resulting in an rvalue
temporary as the Standard dictates.
>
>But still ... why?
Indeed. The kicker, to me, is that MSVC 6 does not seem to exhibit this
extension (at least not by default).
-leor
>
> - Jake Montgomery
--
Leor Zolman --- BD Software ---
www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: download BD Software's free STL Error Message Decryptor at:
www.bdsoft.com/tools/stlfilt.html