Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ecrhub.UUCP Path: utzoo!hcrvax!ecrhub!david From: david@ecrhub.UUCP (David M. Haynes) Newsgroups: net.lang.c Subject: Re: more about programming style Message-ID: <242@ecrhub.UUCP> Date: Wed, 31-Jul-85 08:16:53 EDT Article-I.D.: ecrhub.242 Posted: Wed Jul 31 08:16:53 1985 Date-Received: Fri, 2-Aug-85 06:01:26 EDT References: <272@brl-tgr.ARPA>, <1041@umcp-cs.UUCP> Organization: Emerald City Research, Toronto Lines: 42 > (Entering personal religious belief flammable mode) > > Typedefs are very nice when applied sparingly. Before you use > typedefs, figure out why some intrinsic type won't do---perhaps > the type will have to change on some machines, but once changed > will be fine (e.g., if you need 24 bit integers, perhaps int is > good enough, but maybe you need longs; perhaps you should use a > typedef). Typedefs can also help if a complex type is used very > often. Other than that they just it harder to figure out what's > really happening. > > -- > In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) > UUCP: seismo!umcp-cs!chris > CSNet: chris@umcp-cs ARPA: chris@maryland > Around these parts, its a standard thing to use typedefs with structs. ie: struct foo { }; <- shorter than normal typedef struct foo FOO; Now we can use a declaration like: FOO record; and know that since its capitalized its declared locally. Its also fairly common to use a typedef stream (or numerous #defines) to declare portable declarators. ie: typedef uint16 unsigned int; or #define uint16 unsigned int typedef uint8 char; or #define uint8 char This helps greatly when moving stuff from machine to machine. -- -------------------------------------------------------------------------- David M. Haynes Exegetics Inc. ..!utzoo!ecrhub!david "I am my own employer, so I guess my opinions are my own and that of my company."