are enums integers in ANSI?

David Lai lai at vedge.UUCP
Wed Nov 23 05:42:09 AEST 1988


C: A Reference Manual (Harbison and Steele) says:

	Draft Proposed ANSI C and most current implementations mandate
	that all enumeration types be treated as integer types, and that
	all enumeration constants appearing in expressions have type int.

Does this mean:

	int a;
	enum { abc, def} b;
	enum {ghi, jkl} c;

	b=a;
	a=b;
	a=abc;
	c=abc;
	b=c;

are legal, or are explicit casts necessary?  The sun compiler likes
to complain, will ANSI compilers complain?

-- 
	"What is a DJ if he can't scratch?"  - Uncle Jamms Army
The views expressed are those of the author, and not of Visual Edge, nor Usenet.
David Lai (vedge!lai at larry.mcrcim.mcgill.edu || ...watmath!onfcanim!vedge!lai)



More information about the Comp.std.c mailing list