Enum legality question

David Keppel pardo at june.cs.washington.edu
Thu Jul 28 12:24:13 AEST 1988


I want to do something like:

	enum zork_t { FOO, BAR, BAZ, ZORK, BORK, SPLODGE, SPLAT };
	int a[6];
	zork_t hoof;

	a[FOO] = 23;
	a[BAR] = 55;
	for( hoof=BAZ; hoof<=SPLAT; ++hoof ){
	    a[hoof] = 0;
	}

Question: which of these are legal under ANSI (proposed) C?
How about if I replace the "enum" line with "... FOO=0, ..."?

	    ;-D on  ( This could be worth a gross )  Pardo

			pardo at cs.washington.edu
    {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo



More information about the Comp.lang.c mailing list