[net.lang.c] The legacy of FORTRAN

mwm@ucbtopaz.CC.Berkeley.ARPA (Mike (I'll be mellow when I'm dead) Meyer) (07/20/85)

>Supposedly this is harder to understand.   In the book "Learning
>to Program in C" by Thomas Plum he mentions that they looked
>at a bunch of C code and found out that 90% of C programmers
>use i and j as index variables.

Which just goes to show that the FORTRAN integer type names will always be
with us.

	<mike

malcolm@spar.UUCP (Malcolm Slaney) (07/21/85)

> Which just goes to show that the FORTRAN integer type names will always be
> with us.
Oh, give me a break!  We can blame a lot of things on Fortran but that
isn't one of them.

I bet if you look at most math books (before or after the age of Fortran)
you'd see a lot of summations indexed with i's, j's and even n's.

What a coincidence ..... :-)

Cheers.

							Malcolm

levy@ttrdc.UUCP (Daniel R. Levy) (07/21/85)

From: mwm@ucbtopaz.CC.Berkeley.ARPA (Mike (I'll be mellow when I'm dead) Meyer)
Message-ID: <1021@ucbtopaz.CC.Berkeley.ARPA>

>>Supposedly this is harder to understand.   In the book "Learning
>>to Program in C" by Thomas Plum he mentions that they looked
>>at a bunch of C code and found out that 90% of C programmers
>>use i and j as index variables.
>
>Which just goes to show that the FORTRAN integer type names will always be
>with us.
>
>	<mike
>

I always thought that the reason that Fortran used default i through n to begin
integer variables was from the common use of i through n in mathematics texts
to denote subscripts, which are of course integers; so it would make sense for
C programmers to do the same regardless of the Fortran legacy.  Does that make
any sense?

-Dan-
-- 
                                            Typo of the month:
 _______________________________              ______________
|           yvel nad             |           | ------------ |
|          @ rekcah a            |           || $ rm *>tmp ||
| noisivid smetsys retupmoc t&ta |           ||            ||
|        sionilli eikoks         |           ||            ||
|          "go for it"           |           ||____________||
 --------------------------------             --------------
                                            /ooooooooooooo/ |
                                           /ooooooooooooo/  |
                                           -----------------

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (07/21/85)

> ... 90% of C programmers
> >use i and j as index variables.

> Which just goes to show that the FORTRAN integer type names will always be
> with us.

Hey!  Mathematicians established this convention long before Fortran.
Perhaps 90% of C programmers are literate.

dgary@ecsvax.UUCP (D Gary Grady) (07/22/85)

> >... and found out that 90% of C programmers
> >use i and j as index variables.
> 
> Which just goes to show that the FORTRAN integer type names will always be
> with us.
> 	<mike

Actually, the tradition is much older than Fortran.  Indices are
traditionally i, j, k, and n in mathematics.  And a, b, c, etc. are used
for parameters and x, y, z, etc. for variables.  Fortran just attempted
to follow an older tradition.

Remeber that prior to the mid-50s sometime, the word "computer" was a
job title for someone hired to perform calculations!
-- 
D Gary Grady
Duke U Comp Center, Durham, NC  27706
(919) 684-3695
USENET:  {seismo,decvax,ihnp4,akgua,etc.}!mcnc!ecsvax!dgary

jims@hcrvax.UUCP (Jim Sullivan) (07/22/85)

>>Supposedly this is harder to understand.   In the book "Learning
>>to Program in C" by Thomas Plum he mentions that they looked
>>at a bunch of C code and found out that 90% of C programmers
>>use i and j as index variables.
>
>Which just goes to show that the FORTRAN integer type names will always be
>with us.

Why FORTRAN and not mathematics ?  As I remember my math, i, j, and k are 
generally index variables, a, b, and c are constants; m and n are array
bounds; etc. etc.

The fact the 90% of C programmers use i and j as index variables is not
a particularly stunning fact, it's like saying most programs have at
least one if statement.

Jim

cdl@mplvax.UUCP (Carl Lowenstein) (07/23/85)

In article <1021@ucbtopaz.CC.Berkeley.ARPA> mwm@ucbtopaz.UUCP (Mike Meyer) writes:
>>Supposedly this is harder to understand.   In the book "Learning
>>to Program in C" by Thomas Plum he mentions that they looked
>>at a bunch of C code and found out that 90% of C programmers
>>use i and j as index variables.
>
>Which just goes to show that the FORTRAN integer type names will always be
>with us.

Mathematicians and physicists were using i and j as index variables
long before Fortran.  In fact, long before programmable digital computers.

-- 
	carl lowenstein		marine physical lab	u.c. san diego
	{ihnp4|decvax|akgua|dcdwest|ucbvax}	!sdcsvax!mplvax!cdl

ken@boring.UUCP (07/23/85)

In article <1021@ucbtopaz.CC.Berkeley.ARPA> 
>>at a bunch of C code and found out that 90% of C programmers
>>use i and j as index variables.
>
>Which just goes to show that the FORTRAN integer type names will always be
>with us.

I was under the impression that they came from the use of i and j as
subscripts in mathematical formulae.

	Ken
-- 
UUCP: ..!{seismo,okstate,garfield,decvax,philabs}!mcvax!ken Voice: Ken!
Mail: Centrum voor Wiskunde en Informatica, Kruislaan 413, 1098 SJ, Amsterdam.

mwm@ucbtopaz.CC.Berkeley.ARPA (Mike (I'll be mellow when I'm dead) Meyer) (07/25/85)

My G*D! The that leaving off one little ":-)" can create.

Since history isn't a science, we can't test wether changing FORTRAN to use
A to M for integers would change programmers habits.

BTW, *REAL* mathematicians don't use i to j as indices. REAL mathematicians
don't index over numbers. The index over sets, and use s. :-)

And I always use p (for Pointer) as an index in C :-).

	<mike