Casting pointers
Stephen Clamage
steve at taumet.com
Sat Jul 21 01:50:59 AEST 1990
harkcom at potato.pa.Yokogawa.CO.JP (Alton Harkcom) writes:
>In article <23590 at shamash.cdc.com>
> bls at svl.cdc.com (brian scearce) writes:
> =}It shouldn't compile at all. The mighty CDC C Version 2 prints,
> =}"Operation can only be performed on lvalues", an excellent diagnostic
> ^^^^^^^
> Shouldn't that be rvalue?
No. If the statement is something like:
(char*)p += i;
the complaint is not about the cast, but about the left side of the
+= operator, which must be an lvalue. A cast does not result in an
lvalue. Actually the left side must be a *modifiable* lvalue, and the
error message would be better if it said that.
--
Steve Clamage, TauMetric Corp, steve at taumet.com
More information about the Comp.lang.c
mailing list