Hacker News new | ask | show | jobs
by PavlovsCat 2449 days ago
> Also, FORTRAN globals and variables called i,j and k ROCK!

I always thought they're great in any language with globals, is there a reason they're especially good in FORTRAN?

1 comments

FORTRAN has some "beautiful" implicit typing rules. Most FORTRAN programmers will disable this with an `implicit none` statement because nobody likes the type of the variable being defined by which character it starts with. So, if the implicit typing rules are in play, i,j,k are definitely integers, otherwise they can be something else.

Offhand, (it has been a long time since I programmed in FORTRAN) I do not know how the scoping rules regarding `implicit none` function with globals. Presumably i, j, k are integers (which would be the implicit type) so it might not be a problem, but they are also often used as basis vectors... so they might be vectors and `implicit none` becomes important.

Also possible, you are dealing with some really old FORTRAN60 compatible code and they are actually iteration control variables and a subroutine wrapped around an arithmetic if is advancing the control variables (which is why they are in global scope) and the outer arithmetic if is performing the branch control as an ur-for loop with gotos. This was the original spaghetti code.