generalized lvalues -- patch outline
Ziemowit Laski
zlaski@apple.com
Mon Nov 22 22:33:00 GMT 2004
On 22 Nov 2004, at 13.01, Nathan Sidwell wrote:
> Ziemowit Laski wrote:
>> Indeed, I now appear to have a mainline mod for C and C++ which
>> allows assignment to lvalue casts for pointer types. What follows is
>> a high-level synopsis of what I did; if there is interest, I can whip
>> up a full-fledged patch, complete with docs. Please let me know.
>
> Please describe the semantics *in detail* of what you are trying to
> achieve. Why are the modify-assignment operators not allowed? That
> appears non-orthogonal.
Modify-assignment is (or should be; I'll check) allowed.
The semantics are that a C-style cast of an lvalue will itself be
treated as an lvalue under the following circumstances:
- The lvalue cast does not induce a type conversion (if it does, then
we use the type conversion instead);
- The lvalue cast is being assigned to, incremented or decremented;
- The lvalue is of a pointer type, and is being cast to a pointer
type. (This will need to be relaxed somewhat should people desire
Microsoft compatibility, at least for C.)
Of course, all of this only with the -flvalue-cast-assign flag
specified.
--Zem
More information about the Gcc
mailing list