generalized lvalues
Ziemowit Laski
zlaski@apple.com
Fri Nov 19 21:58:00 GMT 2004
On 19 Nov 2004, at 4.38, Nathan Sidwell wrote:
>
> Do you need a solution that works in both C and C++?
Yes.
>
> If you're adding language extensions, you should choose one that is the
> smallest possible extension (ideally, it would be 'not-an-extension').
> The cast-as-lvalue idea fails for C++, as Joe Buck has pointed out, and
> it fails for C as it makes a whole swathe of ill-formed uses now
> well-formed,
> but with non-intuitive semantics.
Yes, Joe raised a very good point, although it made me realize that I'm
not really
after the whole casts-as-lvalues enchilada, but really after the
ability to be
assign to a cast. I believe the compiler will currently complain about
assigning
to a non-lvalue, and what I'd need is some sort of -fassign-to-cast
flag (off by default,
but on for ObjC/ObjC++) that would let it go through. Of course, the
compiler should only
allow the assignment if the cast does _not_ result in a temporary being
created.
--Zem
More information about the Gcc
mailing list