question about an array of enum

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Thu Nov 8 12:04:51 AEST 1990


In article <1990Nov8.000847.16340 at athena.mit.edu>, scs at adam.mit.edu (Steve Summit) writes:
> Does the standard really allow a different choice to be made for
> different enumerations?

Consider the following program fragment:

	enum foo *p;
	... { ... f((char*)p); ... } ...
	enum foo {a,b,c};

Last time I tried that in a C program it worked.  But on a machine
where byte pointers and word pointers have different formats, the
compiler needs to know what casting p to (char*) involves.  Such a
machine's C compiler could of course always use 'int'.

-- 
The problem about real life is that moving one's knight to QB3
may always be replied to with a lob across the net.  --Alasdair Macintyre.



More information about the Comp.lang.c mailing list