Fortran for C Programmers

https://news.ycombinator.com/rss Hits: 3
Summary

Fortran For C Programmers This note is limited to essential information about Fortran so that a C or C++ programmer can get started more quickly with the language, at least as a reader, and avoid some common pitfalls when starting to write or modify Fortran code. Please see other sources to learn about Fortran’s rich history, current applications, and modern best practices in new code. There have been many implementations of Fortran, often from competing vendors, and the standard language has been defined by U.S. and international standards organizations. The various editions of the standard are known as the ‘66, ‘77, ‘90, ‘95, 2003, 2008, and (now) 2018 standards. Forward compatibility is important. Fortran has outlasted many generations of computer systems hardware and software. Standard compliance notwithstanding, Fortran programmers generally expect that code that has compiled successfully in the past will continue to compile and work indefinitely. The standards sometimes designate features as being deprecated, obsolescent, or even deleted, but that can be read only as discouraging their use in new code – they’ll probably always work in any serious implementation. Fortran has two source forms, which are typically distinguished by filename suffixes. foo.f is old-style “fixed-form” source, and foo.f90 is new-style “free-form” source. All language features are available in both source forms. Neither form has reserved words in the sense that C does. Spaces are not required between tokens in fixed form, and case is not significant in either form. Variable declarations are optional by default. Variables whose names begin with the letters I through N are implicitly INTEGER, and others are implicitly REAL. These implicit typing rules can be changed in the source. Fortran uses parentheses in both array references and function calls. All arrays must be declared as such; other names followed by parenthesized expressions are assumed to be function calls. Fortran has a lot o...

First seen: 2025-05-18 01:49

Last seen: 2025-05-18 03:49