Reply to post: Re: Implicit typing of variables

Microsoft gives Windows 10 a name, throws folks a bone

Norman Nescio Silver badge

Re: Implicit typing of variables

Because I, J, K, L, M, O and P, and any variable with a name beginning with those, is an integer in Fortran, and we all learned Fortran in College before BASIC was invented.

I gave you an upvote, but FORTRAN implicit variable name rules were that variables starting with I-N were integers, everything else, reals, unless, of course, you declared IMPLICIT NONE at the start.

The problem with implicit typing of variables is that if you misspell a variable name, it won't be caught by a compiler, so you can get quite subtle errors. As FORTRAN is case insensitive in the source, you can inadvertently substitute a lower-case L for a capital i and <vice versa>, so a variable named "loopcounter" can be confused with "Ioopcounter". If you couple this with the undefined value of an uninitialised variable - some systems set such undeclared variables to zero, others provide you with any old junk, you can get some pretty nasty behaviour.

I've had to debug some pretty gnarly FORTRAN code in my time. Modern tools make this easier, but a lot of code used in academia is not written by expert programmers, but by experts in whatever field that happened to need to do some data processing. FORTRAN made it easy to write code, but unfortunately left the door open to writing nearly unmaintainable bad code.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2019