Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!fluke!ssc-vax!dmg From: dmg@ssc-vax.UUCP (David Geary) Newsgroups: comp.lang.c Subject: Re: case sensitivity Message-ID: <2622@ssc-vax.UUCP> Date: 25 Apr 89 17:18:37 GMT Organization: Boeing Aerospace Corp., Seattle WA Lines: 81 S. Manoharan writes: Bill ({ uunet | novavax } !twwells!bill) writes: ::: In article <17061@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: ::: More seriously: I have used languages that ignore case, and languages ::: that care about case, and have never been particularly impressed with ::: the former, nor particularly excited about the case distinctions in the ::: latter. I agree. :: I use the case of identifiers to tell me some important bits of :: information about the identifier that are not properly conveyed by the :: name. Here's my table: Whatever the table was, it's gone ;-). I assume the table was a table such as: FUNCTIONS SomeName() MACROS WITH TOKENS somename() DEFINED CONSTATNS SOMENAME VARIABLES some_name :: Having these distinctions made consistently makes reading the code :: much easier. Agreed. : Having two ids foo and FOO that mean two different things will sure : lead to confusion. If one accepts this, Maybe. Consider: 1) Whenever I write code I stick to a convention similar to the table above. 2) Whenever I write code "professionally" (meaning it may someday be meant for public consumption), I insert a comment at the top of the file containing main(), (and possibly in other files where I feel it's appropriate), that shows the table of conventions I use in my code. If the author states his conventions, and sticks with the conventions then I believe case-sensitivity IMPROVES the readability of the code. Therefore, if one came across the following code fragment: for(max_names = 0; max_names < MAX_NAMES; ++max_names) ... it would be immediately obvious that MAX_NAMES was a defined constant, and max_names was a variable. Realize that I consider the choice of name "max_names" for the variable above bad style. max_names does not convey the purpose of the variable accurately. It should be named name_counter or something similar to indicate that it is counting names. However, that does not mean that it is difficult to distinguish max_names from MAX_NAMES. Along the same vein then, I agree that having two "ids" foo and FOO is ABT (A Bad Thing). But it's not ABT because it's difficult to distinguish which foo is FOO. The moral of the story is that, just like any other feature of a programming language, C's case sensitivity CAN be used in a haphazard manner, that creates incomprehensible code. (See the thread on the comma operator currently being discussed). I can use goto's to create disguisting code. I can use commas to create hard to understand code. I can use case sensitivity, etc. However, just as is the case with many features of C, when used consistently, and in the right contexts, case sensitivity can be used to one's advantage. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ David Geary, Boeing Aerospace, Seattle ~ ~ "I wish I lived where it *only* rains 364 days a year" ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~