Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!wuarchive!uunet!hsi!stpstn!lerman From: lerman@stpstn.UUCP (Ken Lerman) Newsgroups: comp.lang.c Subject: Re: a style question Message-ID: <5636@stpstn.UUCP> Date: 2 Oct 90 13:41:53 GMT References: <7341@darkstar.ucsc.edu> <8660@ncar.ucar.edu> <1990Sep30.220839.20183@nntp-server.caltech.edu> <1990Oct1.174625.22061@zoo.toronto.edu> Reply-To: lerman@stpstn.UUCP (Ken Lerman) Organization: The Stepstone Corporation, Sandy Hook, CT 06482 Lines: 25 In article <1990Oct1.174625.22061@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes: ->In article <1990Sep30.220839.20183@nntp-server.caltech.edu> manning@nntp-server.caltech.edu (Evan Marshall Manning) writes: ->>Don't ever use single-character variable names. I use 'ix' for ->>loop index variables for which I can come up with no better name... -> ->In what way is "ix" superior to "i"? Both are meaningless names in ->this context. If the name is not going to be meaningful -- and in the ->context of a short loop, it's not clear that making it meaningful is ->either possible or particularly important -- then at least keep it short. -> ->There is an old prejudice against using "I" or "O" for a variable name, ->arising from confusion with "1" and "0", but the lowercase letters don't ->have that problem. ->-- ->Imagine life with OS/360 the standard | Henry Spencer at U of Toronto Zoology ->operating system. Now think about X. | henry@zoo.toronto.edu utzoo!henry I think I first saw this in one of Jerry Weinberg's books. Don't use two variable names which differ in only a single character. That way a one key typo won't hurt you. If you use a lot of single character variable names, one miskey and you have a syntactically valid program which does the wrong thing. Of course, using ix and iy has the same problem. Are "row" and "column" better variable names? Probably, but x and y are more convenient. :-) Do what I say, not what I do. :-) Ken