Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!ucsd!chem.ucsd.edu!tps From: tps@chem.ucsd.edu (Tom Stockfisch) Newsgroups: comp.lang.c Subject: Re: Just Wondering Message-ID: <447@chem.ucsd.EDU> Date: 24 Apr 89 07:33:50 GMT References: <13159@dartvax.Dartmouth.EDU> <10088@smoke.BRL.MIL> <1126@ptolemy.arc.nasa.gov> Reply-To: tps@chem.ucsd.edu (Tom Stockfisch) Organization: Chemistry Dept, UC San Diego Lines: 43 In article <1126@ptolemy.arc.nasa.gov> raymond@ptolemy.UUCP (Eric A. Raymond) writes: >In article <10088@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: >>> Why is C case-sensitive? >>It makes programs considerably more readable, and expands the available >>name space considerably. >I agree that they improve your namespace, but not in any usable way. >(Sort of like the big gear/little gear combinations on a bike. You >can use them, but it's not a good idea.) Although its debatable, I >feel its bad style to use the same name (in diffrent cases) for >different purposes within a program. I try to avoid it, but I succumbed to temptation after reading C++ code. In C++ a struct tag name is also used as the name of a constructor for that struct. In C I always use upper case for types and (mostly) lower case for functions. I used to use lower case for types until I ran into a pcc bug in which inner-scope auto variable names collide with typedef names. Anyway, I now use the lower case version of a struct name as the name of the constructor of the struct. e.g., typedef struct NODE { char *name; struct NODE *lchild; struct NODE *rchild; } NODE; NODE * node(name) char *name; { NODE *result = malloc( sizeof(NODE) ); result->name = strsave(name); result->lchild = result->rchild = NULL; return result; } Note that I overload NODE as the structure tag and typedef name. This also is similar to the way C++ does things. -- || Tom Stockfisch, UCSD Chemistry tps@chem.ucsd.edu