generalized lvalues -- patch outline
Eric Botcazou
ebotcazou@libertysurf.fr
Tue Nov 23 21:10:00 GMT 2004
> I haven't looked at that list, but one data point: CW restricts this
> cast to pointers, so that's good enough for CW compatibility. I guess
> we learned just today (thanks, Eric!) that Solaris supports some
> version of this extension, at least for C. We don't yet know the
> boundaries of Sun's version of the extension.
Since you so kindly asked... :-)
Sun seems to restrict it to pointers too, i.e. it rejects (short)v = 1 as well
as:
void bar(unsigned long addr)
{
*((int *)addr)++ = 1;
}
with:
"ext.c", line 8: a cast does not yield an lvalue
cc: acomp failed for ext.c
Here's the reaction of the C++ compiler:
poog% cat ext.C
void foo(char *p)
{
*((long *) p)++ = 1;
}
poog% CC -S ext.C
"ext.C", line 3: Error: Operand for operator "++" must be an lvalue.
1 Error(s) detected.
--
Eric Botcazou
More information about the Gcc
mailing list