typedef laxity

Bob Lied lied at ihuxy.ATT.COM
Sat Apr 16 03:45:05 AEST 1988


In article <759 at xyzzy.UUCP> throopw at xyzzy.UUCP (Wayne A. Throop) writes:
>It occurs to me that there is another way to do this, and a form of
>integer subranges to boot, all within draft X3J11 C.  Consider:
>
>        typedef enum {low_temperature=(-40), high_temperature=4000} 
>                temperature_t;
>        typedef enum {low_pressure=0, high_pressure=500} 
>                pressure_t;
>        temperature_t t;
>        pressure_t p;

You are trying to eat your cake and have it, too.  If
temperature_t and pressure_t are distinct types, then
they are also distinct from int.  Therefore,
	t = 32;
should also give a type mis-match warning.

	Bob Lied	ihnp4!ihuxy!lied



More information about the Comp.lang.c mailing list