type cast in initializer

stevens at hsi.UUCP stevens at hsi.UUCP
Wed Jan 29 23:15:57 AEST 1986


I've found the two lines

	int	x = 0;
	char	*ptr = (char *) &x;

acceptable to every C compiler I've used, until running into the
Whitesmith's C compiler.  They refuse to accept the type coercion "(char *)"
on the second initialization.  As I read K&R this should be acceptable
through the rules

	initializer:
		= expression			(Sec. 8.6)

	expression:
		( type-name ) expression	(Sec. 7.2)

I talked to Whitesmiths about this and they are firm that their
interpretation of the "standard" is that a type coercion following the
equals sign is not allowed and they don't plan to change their compiler.

Am I missing something ??  What does the proposed ANSI standard have
to say about this ??

	Richard Stevens
	Health Systems International, New Haven, CT
           ihnp4 ! hsi ! stevens



More information about the Comp.lang.c mailing list