Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One of my favourite features of Fortran is in its array implementation. You can index arrays however you like.

Do you like your initial value to be at index 1? Cool. Prefer to index arrays from 0 instead? Sure, go ahead.

How about an array with indexing symmetric around zero?

    double precision :: arr(-100:100)
Beautiful!


Pascal derived languages also enjoy this capability.

Your example across most of them is something like:

    type 
        precision = array [-100..100] of double;


Arrays are actually not part of Fortran’s type system; neither are pointers. These are attributes of variables and components, instead.

And the language has some nasty pitfalls for users (and some nonportable cases due to bugs in some compilers) with non-default lower bounds. A simple assignment statement like A=B might change the bounds of A, but A=(B) and A(:)=B cannot. It’s best to avoid non-default lower bounds in general.


As described on the linked article....


I wrote it.


Great, it isn't as if I pay attention to the nicknames and the authors of the articles, and your reply was formulated in a way that came for as if was someone replying to me without having read the article, hence why I replied like that.

Interesting article.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: