a style question

Richard Bumby bumby at math.rutgers.edu
Thu Oct 4 12:06:40 AEST 1990


In article <A066MF5 at xds13.ferranti.com> peter at ficc.ferranti.com (Peter da Silva) writes:

> In article <2039 at excelan.COM> donp at 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 at math.rutgers.edu
  voice communication unreliable -- telephone ignored -- please use Email



More information about the Comp.lang.c mailing list