Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!brutus.cs.uiuc.edu!apple!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Variable Name Conventions Summary: Beware the reserved classes Message-ID: <15698@haddock.ima.isc.com> Date: 19 Jan 90 20:27:44 GMT References: <36190@cornell.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 20 In article <36190@cornell.UUCP> gordon@cs.cornell.edu (Jeffrey Adam Gordon) writes: >I have seen C source with at least three different types of variable >names. Some are just 'var' while others are either '_var' or '__var.' >What I'd like to know is: is there any convention for using >underline (and for that matter, CAPS) in C variable/function/structure >names. Does anyone have a neat system they like to use when, say, >defining typedefs (such as "all typedefs will end in '_t') or >pointers (like '_p'). If you're a user (rather than the implementor of the C runtime system) then you should avoid creating any names beginning with underscore, as most of these are reserved by ANSI C. Likewise, you should probably not use _t for your own typedefs, because POSIX reserves this entire class for use in . Beyond this, it's pretty much personal convention, which should probably be discussed off-line to keep the S/N ratio from deteriorating too badly. Karl W. Z. Heuer (karl@haddock.isc.com or ima!haddock!karl), The Walking Lint