[comp.lang.c] style for typedef names

karl@ima.isc.com (Karl Heuer) (02/09/91)

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 <sys/types.h> 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