The Weird and The Wonderful
The Weird and The Wonderful forum is a place to post Coding Horrors,
Worst Practices, and the occasional flash of brilliance.
We all come across code that simply boggles the mind. Lazy kludges, embarrasing mistakes, horrid
workarounds and developers just not quite getting it. And then somedays we come across - or write -
the truly sublime.
Post your Best, your worst, and your most interesting. But please - no
programming questions . This forum is purely for amusement and discussions on code snippets. All
actual programming questions will be removed.
|
|
 |

|
It is from Fortran. Integers were i to n, everything else was real. i happened to be the very first integer letter. Everyone unknowingly just followed Fortran.
|
|
|
|

|
Yes - for me it is a Fortran language practice. In Fortran IV, any variable starting with I, J, K, L, M, N is an integer (case-insensitive), whereas a variable starting with any other letter is a float. This continued for me, through C, Java, C++, C#.
|
|
|
|
|

|
There were but they were implicit.
Any variable name beginning with a letter between (and including) the first two letters of INteger was an integer, any other variable was a real.
|
|
|
|

|
Fascinating!
I know and still use that convention but had no idea what that particular set of letters was chosen until now.
Thanks.
Murray
|
|
|
|

|
Some of the earliest computer pioneers were mathematicians, and integers are usually represented by i, j and k. I guess it was just a convention academics adopted to avoid having to mentally remap a limited set of typewriter symbols.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|

|
I was using i for index before I was introduced to Fortran.
|
|
|
|

|
If you were using 'i' before being introduced to FORTRAN, you must have been late being introduced. When I started, there was no lowercase!
After some assemblers, FORTRAN IV (aka FORTRAN 66) was one of the first high level languages that I learnt and so I (like everybody else) used I, J, and K as loop variable names. I also used FORTRAN II at college.
Shouldn't
for(int i =0; i |
|
|
|

|
Yes, quite. BASIC in 1983, Pascal in 1985, COBOL in 1986, Fortran (77?) in 1987. But BASIC is the only one I've been paid to use, COBOL and Fortran I only touched in college, and Pascal I haven't used at all since becoming comfortable with C. C# pays the bills now.
|
|
|
|

|
It's also from FORTRAN for me, but we used just "i" rather than "index" partly because it saved time and space. We didn't have IDE's in those days, but punched cards (or paper tape) and is was a lot quicker to type a single character variable name on a punched card than a longer one. Saved waste as well if you mistyped "index" as "inedx" you had to chuck the card and type a new one.
With paper tape each character occupied 1/10th inch of tape, so "index" used 5 times the paper each time you typed it. With a long subroutine, that could get significant and make the roll a lot bigger (and heavier) and harder to roll back up again when it spooled off the end of the reader...
We only had 6 character variable names anyway...
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
 |
|
|
General
News
Suggestion
Question
Bug
Answer
Joke
Rant
Admin