Path: utzoo!mnetor!uunet!husc6!maynard!campbell From: campbell@maynard.BSW.COM (Larry Campbell) Newsgroups: comp.lang.c Subject: Re: typedef laxity Message-ID: <1071@maynard.BSW.COM> Date: 11 Apr 88 17:33:43 GMT References: <1070@maynard.BSW.COM> <542@picuxa.UUCP> Reply-To: campbell@maynard.UUCP (Larry Campbell) Organization: The Boston Software Works, Inc. Lines: 38 In article <542@picuxa.UUCP> gp@picuxa.UUCP (Greg Pasquariello X1190) writes: <>In article <1070@maynard.BSW.COM> campbell@maynard.BSW.COM (Larry Campbell) writes: <>>It seems to me someone should complain about this code: <>> <>> typedef int TEMPERATURE; <>> typedef int PRESSURE; <>> <>> TEMPERATURE tx, ty; <>> PRESSURE px, py; <>> <>> ty = py; /* type clash */ <>> <>>But none of the compilers I've tested (pcc, VAX-11 C, Wang VS C, Turbo C) <>>complain about it, and, even worse, _lint_ doesn't complain! <> <> <>The compiler does not complain about this, because it is not really a type <>clash. Typedef simply creates synonyms for a type. The compiler treats both <>"new types" the same as int. <> <>Greg Pasquariello <>ihnp4!picuxa!gp Well, I have gotten several mail messages and seen several followups all saying the same thing: "That's just the way it works." As opposed to saying "It works this way because of ". I still haven't heard anyone argue that mixing types (all right, mixing type NAMES) like this is a good programming practice, and haven't heard any arguments as to why it's a _good thing_ that lint doesn't complain. I _know_ how it works. I am arguing that how it works is a _bad thing_. I would like lint, at least, to complain. Can anyone convince me that it shouldn't? (For example, show me a code fragment where it is both reasonable and readable to mix type names as in the above example.) -- Larry Campbell The Boston Software Works, Inc. Internet: campbell@maynard.bsw.com 120 Fulton Street, Boston MA 02109 uucp: {husc6,mirror,think}!maynard!campbell +1 617 367 6846