ZINTEL Gerhard wrote 22 lines
>
> Hello all,
>
> Friday, July 11, 2003, 3:18:58 PM, you wrote:
>
> ZG> hello list members,
> ...
> ZG> which type to be used for a type cast (that is not
> allowed for the left
> ZG> side) or how to use an address operator to manage it?
> at least in my fpc 1.0.6 typecasts for the left side are allowed,
> value := r; // error
> real(value) := r; // works ! ;-)
>
In the (at least my) reference guide in chapter "6.4 Value typecasts"
(version 1.8) there is written:
"Value typecasts cannot be used on the left side of assignments, as variable
typecasts."
doesn't it mean that the above is not allowed or do I miss something?
It means you cannot do
TSomeType(1):=SomethingElse
as opposed to
TSomeType(AVariable):=SomethingElse
Which means essentially that a typecast of a constant is still a constant, and cannot be assigned to. (same goes for expressions)
You can of course do
SomethingElse:=TSomeType(1)
Michael.