Lvalues and casts
Chris Torek
chris at mimsy.UUCP
Thu May 25 13:27:58 AEST 1989
In article <1912 at ektools.UUCP> randolph at ektools.UUCP (Gary L. Randolph)
writes:
>... I have an extension to the original question. I have
>used casts on the LHS of assignment, but without actually assigning to
>the cast. Example:
...
>if (semaphore=='a')
> *(int *)data = 22;
>else if (semaphore=='b')
> *(float *)data = 64;
The result of a cast is not an lvalue, but the result of an indirection
*is* an lvalue. These assignments are thus to lvalues and hence legal
(provided, of course, the pointers point at the right objects).
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.lang.c
mailing list