Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!ima!dirtydog!karl From: karl@ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: style for typedef names (was: Is typedef char BUFFER[20] legal?) Keywords: typedef, legality, style Message-ID: <1991Feb08.215420.13001@dirtydog.ima.isc.com> Date: 8 Feb 91 21:54:20 GMT References: <1212@tredysvr.Tredydev.Unisys.COM> <1701@bbxsda.UUCP> Sender: news@dirtydog.ima.isc.com (NEWS ADMIN) Organization: Interactive Systems Lines: 22 In article <1701@bbxsda.UUCP> scott@bbxsda.UUCP (Scott Amspoker) writes: >In article <1212@tredysvr.Tredydev.Unisys.COM> paul@tredysvr.Tredydev.Unisys.COM (Paul Siu) writes: >>Can anyone also tell me what is the most common style convention for type >>names, I usually put them all in capitals. > >You're not alone here. We tend to use uppercase names for typedefs also. But it's extremely common to use all-caps for constants (e.g. BUFSIZ, EOF, NULL). I disrecommend using this convention for type names. (The type FILE is a historical wart; if it were being added today, it would almost certainly be spelled file_t instead.) You could use the xxx_t convention, but since this entire namespace is technically reserved by the POSIX header, you might be better off using a slight variant, e.g. xxx_T (with the final T capitalized to avoid the potential collision). Other common styles are initial-cap (typedef struct {int x,y;} Point), and all lowercase (typedef int bool, int32). This being a rather volatile topic, I think I'll refrain from making any positive recommendations at this time. Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint