Happy Birthday FORTRAN, and its one-based array technology !

This forum is meant for anything you would like to share with other visitors
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Happy Birthday FORTRAN, and its one-based array technology !

Post by Phil Hepburn »

Hi guys,

Since I was recently talking about FORTRAN and its one-based arrays, and how I used it for scientific (Chemistry / Physics) use way back when, I thought you may be interested in this link I just got today :-

https://opensource.com/article/17/11/ha ... ay-fortran

Looks like it won't be disappearing any time soon.

It interesting to see what it is used for today.

Regards,
Phil.
Frank Maraite
Posts: 176
Joined: Sat Dec 05, 2015 10:44 am
Location: Germany

Happy Birthday FORTRAN, and its one-based array technology !

Post by Frank Maraite »

Hi Phil,

I used FORTRAN77 lastly when I did my diploma work 1984. Then I learned C and dBase and thought that FORTRAN is very outdated. I believe one reason why it is still there: people don't want to learn new things once they are familiar with a tool. And of course the non existing interoperability of those other languages. From my point of view there is nothing we cannot do in C and it's successors too but there are many things we cannot do in FORTRAN.

Maybe I'm wrong. There are so many languages out there ...

Frank
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Happy Birthday FORTRAN, and its one-based array technology !

Post by Phil Hepburn »

Hi Frank,

FORTRAN 77 was the last version I tried too :whistle:

However, if you read the Wikipedia entry for FORTRAN you will see that it has had quite a few updates and facelifts - AND - it was designed to be scientific - hence 'Formula Translator'.

I think you will find it good at what it is designed to do. Did you read the article and the code going into outer space etc., etc. ?

My point was that if it is so mathematical and science driven, one based arrays seems to have gone down well ;-0)

Chris is right in my opinion and zero base was forced by the C & C++ guys involved in the Microsoft development team. Microsoft were never that good at languages - that was Borland!

My 9 cents worth,
Cheers,
Phil.
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

Happy Birthday FORTRAN, and its one-based array technology !

Post by rjpajaron »

I am Cobol guy: '87 no idea why!

Arrays on Cobol? I have no idea also.

Phil Hepburn wrote:Hi Frank,

FORTRAN 77 was the last version I tried too :whistle:

However, if you read the Wikipedia entry for FORTRAN you will see that it has had quite a few updates and facelifts - AND - it was designed to be scientific - hence 'Formula Translator'.

I think you will find it good at what it is designed to do. Did you read the article and the code going into outer space etc., etc. ?

My point was that if it is so mathematical and science driven, one based arrays seems to have gone down well ;-0)

Chris is right in my opinion and zero base was forced by the C & C++ guys involved in the Microsoft development team. Microsoft were never that good at languages - that was Borland!

My 9 cents worth,
Cheers,
Phil.
User avatar
ArneOrtlinghaus
Posts: 386
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Happy Birthday FORTRAN, and its one-based array technology !

Post by ArneOrtlinghaus »

I started my programmer career with Fortran 77. I am glad that I can use other programming languages now. But it depends on the task someone has to resolve. If it is more important to run long duration simulation programs on super computers it can still be convenient to do it in Fortran. I remember having worked with programs of few thousands of lines spending very much main frame time to do what I should do. And now? Now we have programs of some milions lines of code, but most of the code is used only for user I/O and not for heavy calculations.

What is regarding the zero based arrays:
I believe that it was the pointer approach in the 70s that fitted so nice to highly optimized C programs that introduced thinking zero based: The data pointer to an array is immediately the pointer to the first element using a 0 offset. And this will remain, it's the same why programmers still are using Fortran...

Arne
FFF
Posts: 1535
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Happy Birthday FORTRAN, and its one-based array technology !

Post by FFF »

Arne Ortlinghaus wrote:The data pointer to an array is immediately the pointer to the first element using a 0 offset.
Yep. But the fundamental error was, the "thing" it points to is Thing #1, not #0 - counting starts with 1... So the problem was not a possible offset, but the way the index was semantically interpreted... Yes, you have to add a cycle for access to the first element, but, OTOH, if you use arrays there are more than one element ;) - and for all other you have to calculate anyway...
But, as you wrote, it will stay, like so many cemented things of the past, sadly.

Karl
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
ArneOrtlinghaus
Posts: 386
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Happy Birthday FORTRAN, and its one-based array technology !

Post by ArneOrtlinghaus »

Yeah,
but we have many similarities in our normal live:
If you are 0 years old, you are in your first live of year.
If you go to the first floor of a building, in reality you are in a building that has at least two floors. So the first upper floor should be the second "total" floor, especially if you think in one-based arrays...
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Happy Birthday FORTRAN, and its one-based array technology !

Post by Karl-Heinz »

I do not know if anyone ever had to work with VB 6.0 or VBA, but here are some examples of how VB handles arrays. The lower limit of the array is 0 by default, but may even be negative.

// 8-element array -> index 0 to 7
Dim a(7) As Integer

// 8-element array -> index 1 To 8
Dim a(1 To 8 ) As Integer

// 8-element array -> index -3 To 4
Dim a(-3 To 4 ) As Integer


There´s even a setting - but that works on modul level only:

Option Base <nBase>

but MS itself recommends not to use this setting ;-)

regards
Karl-Heinz
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Happy Birthday FORTRAN, and its one-based array technology !

Post by Phil Hepburn »

Hi K-H,

That is indeed interesting - and, in my opinion more the way a high level language should be.

The convenience should be to the developer and his/her business solution code, NOT the convenience of the compiler writer. After all its just the use of an off-set or two.

If it is performance 'they' are after then make the default to the fast option, and give us programmer guys back some flexibility :dry:

Anyway such comments as these are now 'old hat' and 'past it', "moribund", since we have some wonderful Collection classes as well as LINQ to manage their data. Who needs arrays !?

Still, its a good topic for discussion and reflection I feel ;-0)

Best regards,
Phil.
Frank Maraite
Posts: 176
Joined: Sat Dec 05, 2015 10:44 am
Location: Germany

Happy Birthday FORTRAN, and its one-based array technology !

Post by Frank Maraite »

Hi Karl-Heinz,

I think we should talk about compilers for professionals and not about toys for kids :-))

Frank
SCNR
Post Reply