Path: utzoo!mnetor!uunet!ncc!alberta!att-ih!ihnp4!ihuxy!lied From: lied@ihuxy.ATT.COM (Bob Lied) Newsgroups: comp.lang.c Subject: Re: typedef laxity Message-ID: <2489@ihuxy.ATT.COM> Date: 15 Apr 88 17:45:05 GMT References: <1070@maynard.BSW.COM> <757@xyzzy.UUCP> <759@xyzzy.UUCP> Reply-To: lied@ihuxy.UUCP (55626-Lied,R.) Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 18 In article <759@xyzzy.UUCP> throopw@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