On Sun, May 12, 2013 at 04:12:45PM -0700, Jay Michael wrote:
gpc version 20070904, based on gcc-3.4.5 (mingw special) Given type INT16 = INTEGER attribute( size=16 ) ; type WORD16 = Cardinal attribute( size=16 ) ; var i16 : INT16 ; var w16 : WORD16 ; why does WORD16(I16) := W16 ; produce "error: invalid lvalue in assignment"?
I would think that the reason is that to the left of the assignment operator you need a variable or equivalent, in C jargon also known as an lvalue (i.e. something that has a persistent memory address).
Note that a variable by itself is both an lvalue and an expression (an rvalue, though this term is little used), but not every expression is an lvalue (e.g. v + 1 is not an lvalue; you cannot assign anything to it).
In particular, casting is an operator that yields an rvalue, but not an lvalue. Casting needs to done to the right of the assignment operator.
(The previous warnings about casting still stand.)
Tom