Path: utzoo!attcan!uunet!jarthur!usc!julius.cs.uiuc.edu!psuvax1!rutgers!gauss.rutgers.edu!math.rutgers.edu!bumby From: bumby@math.rutgers.edu (Richard Bumby) Newsgroups: comp.lang.c Subject: Re: a style question Message-ID: Date: 4 Oct 90 02:06:40 GMT References: <7341@darkstar.ucsc.edu> <8660@ncar.ucar.edu> <1990Sep30.220839.20183@nntp-server.caltech.edu> <1990Oct1.174625.22061@zoo.toronto.edu> <2039@excelan.COM> Organization: Rutgers Univ., New Brunswick, N.J. Lines: 31 Cc: bumby In article peter@ficc.ferranti.com (Peter da Silva) writes: > In article <2039@excelan.COM> donp@novell.com (don provan) writes: > > If you're only going to be typing the name three or four times, what's > > the advantage keeping it a single character? Readability? > > Readability, to some extent. People are used to this notation from > mathematics, and this provides the necessary context. If you give it a > "real" name then you start to wonder what it might be used for outside > the loop. . . . Two comments: (1) Isn't it about time that we all got together and insisted that the mathematical convention is WRONG. Most mathematical exposition would benefit from free use of words, rather than letters, as primitive symbols. (2) I found some programs that did a job for which I intended to write my own utilities, and found that they contained a device that I had not seen elsewhere; and, in spite of my admiration for the programmer, I'm not sure I like. The program contained many short loops. Each loop used a mathematics-style index like 'i'. The curious feature was that the loop and local declaration of i were made into a block. This had the advantages of emphasizing the limited scope of the index variable and putting the declaration in the most natural (?) place, but the disadvantage of introducing an extra level of structure into the program. It would seem that this increases clarity when the loops are very short, and has very much the opposite effect otherwise. -- --R. T. Bumby ** Math ** Rutgers ** New Brunswick ** NJ08903 ** USA -- above postal address abbreviated by internet to bumby@math.rutgers.edu voice communication unreliable -- telephone ignored -- please use Email