Lvalues and casts

Norman Diamond diamond at diamond.csl.sony.junet
Wed May 24 23:41:10 AEST 1989


In article <847 at tub.UUCP> net at tub.UUCP (Oliver Laumann) writes:

>>	(int *)cp = ip;
>>The PCC, however, says "illegal lvalue in assignment".  Is this legal
>>C, i.e. is the result of a cast really an lvalue?

In article <17370 at usc.edu> blarson at skat.usc.edu (Bob Larson) writes:

>Casts are never lvalues.

True.

>Gcc documents this bug as a feature.

Hmm.  There are ways that it could be construed as a feature, and it
doesn't break good code, but it really deserves a warning except when
some fool disables such a warning.

>(Hopefully it is caught by -pedantic)

Yeah, let's hope so.

Now get this:  I am trying to fix a PCC.  This PCC not only accepts
such a construct, but its own code USES such a construct.  And to
stop using it would require just enough of a change, non-minimal and
not necessary at this time, that I'm not fixing it at this time....

--
Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.co.jp at relay.cs.net)
  The above opinions are my own.   |  Why are programmers criticized for
  If they're also your opinions,   |  re-implementing the wheel, when car
  you're infringing my copyright.  |  manufacturers are praised for it?



More information about the Comp.lang.c mailing list