Type of expression in switch statement

Chris Torek chris at mimsy.umd.edu
Mon Oct 30 18:40:56 AEST 1989


In article <1989Oct30.043155.1931 at eng.umd.edu> nero at eng.umd.edu
(Oren L. Stern) writes:
>... where I meant to type "switch (node->tag)", I accidentally typed
>"switch (node)".  cc ... lint took it without complaint ... on a
>Sparcstation 1 running SunOS 4.0.3. ... Is there something wrong with
>Sun's compiler, or is there (gasp!) a mistake in K&R?

For all things T, for all questions of the form:

	T and SunOS conflict.  Is T wrong, or is SunOS wrong?

the probability of the answer being `SunOS is wrong' is about 95%.  :-)

This was fixed some time ago in 4BSD:

	"foo.c", line n: warning: switch expression not type int

Incidentally, switch expressions of type `long' are now legal as well,
so this error message should be changed to `... not integral type'.
-- 
`They were supposed to be green.'
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list