Lvalues and casts

Oliver Laumann net at tub.UUCP
Tue May 23 18:20:56 AEST 1989


I just found out (by accident; I didn't want to actually use it)
that the GNU cc with the -ansi option, the cc under SunOS 4.0 and
the Greenhills C-compiler all happily compile the following program
(without any warnings):

    f () {
	int *ip;
	char *cp;

	(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?

Regards,
--
Oliver Laumann              net at TUB.BITNET              net at tub.UUCP



More information about the Comp.lang.c mailing list