Path: utzoo!mnetor!uunet!husc6!im4u!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!peter From: peter@athena.mit.edu (Peter J Desnoyers) Newsgroups: comp.lang.c Subject: Re: typedef laxity Message-ID: <4627@bloom-beacon.MIT.EDU> Date: 14 Apr 88 22:43:13 GMT References: <1070@maynard.BSW.COM> <542@picuxa.UUCP> <1071@maynard.BSW.COM> <1988Apr12.141046.3577@sq.uucp> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: peter@athena.mit.edu (Peter J Desnoyers) Organization: Massachusetts Institute of Technology Lines: 26 > (not sure who wrote this...) >> typedef int TEMPERATURE; >> typedef int PRESSURE; >> TEMPERATURE tx, ty; >> PRESSURE px, py; >> ty = py; /* type clash */ >> I _know_ how it works. I am arguing that how it works is a _bad thing_. > My opinion of this is the following: (1) I like strong typechecking. For true typechecking, typedef must create a NEW type, rather than a synonym for an existing type. (2) The language features necessary to do such typechecking are not present in C. You can't require values in an expression to be of the same type when they must be promoted to a possibly different type before the expression is evaluated. You really need something equivalent to overloading and inheritance to be able to do such typechecking rationally. Unless you turn C into a COMPLETELY different language (don't laugh - they may do that to FORTRAN) I think we're stuck with typedef creating an alias. Peter Desnoyers peter@athena.mit.edu