Writing robust and “modern” Fortran code

后端 未结 7 1401
有刺的猬
有刺的猬 2020-12-22 15:15

In some scientific environments, you often cannot go without FORTRAN as most of the developers only know that idiom, and there is lot of legacy code and related experience.

7条回答
  •  借酒劲吻你
    2020-12-22 16:06

    Fortran 90/95/2003 is designed so that one can write modular code, if one wants to, via addition of modules, private/public, user defined types, etc. Fortran 2003 introduces further object oriented features. It makes no sense to connect to C to add malloc when Fortran 90 has "allocate" to directly dynamically allocate Fortran arrays in a safer way. Placing your procedures (functions and subroutines) in modules and then "using" the modules will cause the interfaces to be checked. One can use the many debug / checking options of the compilers, such as subscript bounds checking.

    An excellent book to learn about these and other features: "Fortran 95/2003 Explained" by Metcalf, Reid and Cohen. It is definitely a good idea to learn the best features of modern Fortran rather than continuing to write FORTRAN 77 -- if necessary, write coding standards / guide.

提交回复
热议问题