Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site sdcsvax.UUCP Path: utzoo!watmath!clyde!floyd!harpo!decvax!ittvax!dcdwest!sdcsvax!greg From: greg@sdcsvax.UUCP Newsgroups: net.lang.c Subject: Re: What do *YOU* think of typedefs? Message-ID: <554@sdcsvax.UUCP> Date: Fri, 2-Mar-84 14:34:27 EST Article-I.D.: sdcsvax.554 Posted: Fri Mar 2 14:34:27 1984 Date-Received: Sun, 4-Mar-84 00:46:55 EST References: <208@vaxine.UUCP> Organization: EECS Dept., U.C. San Diego Lines: 19 In general, typedefs should be avoided. There are only a couple of cases where typedefs make sense -- primairly to improve transparency or to provide portability. Another way of saying the same thing is that if you ever make use of the fields of a typedef, then you should NOT be using typedefs. Only if you always use the object as a primitive are typedefs proper. Typedefs are one way that C begins to lean toward more modern forms of structuring, like information hiding. But like many of the tools provided by C, it must be used with care and discipline. Typedefs draw a very thin veil over the actual definition of the object. It is thin enough so that you can see through it if you really need to. The fact that it is there means that you shouldn't need to, unless you are the one that implemented the type (in which case, the functionality should be provided by subroutines or macros with the actual mechanism hidden). Now, don't get me wrong -- typedefs are fun and useful. But the overuse of typedefs can confuse rather than make clearer.