Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: a style question Message-ID: <1990Oct3.180939.28262@zoo.toronto.edu> Organization: U of Toronto Zoology References: <7341@darkstar.ucsc.edu> <8660@ncar.ucar.edu> <1990Sep30.220839.20183@nntp-server.caltech.edu> <1990Oct1.174625.22061@zoo.toronto.edu> <1990Oct2.163853.17004@nntp-server.caltech.edu> Date: Wed, 3 Oct 90 18:09:39 GMT In article <1990Oct2.163853.17004@nntp-server.caltech.edu> manning@nntp-server.caltech.edu (Evan Marshall Manning) writes: >>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. > >... speed up this time-critical bit of code by >changing the original cout-up loop to a count-down loop. "But wait," you >say, "What if some later code depends on the value of 'i' after exiting >the loop? ... Two observations: 1. There is much to be said for search primitives that know about word or token boundaries. 2. Variables used over wide sections of code need more attention to clear naming than variables used only in a short loop. >Doesn't this happen to anybody else? (I know Henry gets it all right >the first time, but even he must inherit code, and inherited code >always has declarations like "int i,j,k,l,ii,jj,kk,ll,m;" and no >comments :-) Coding rules are no substitute for competence. Incompetently-written code is a pain to maintain whether or not its author followed some well-meant set of rules. -- 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