Skip to content

Files

Latest commit

66db365 · Sep 3, 2022

History

History

sample_codes

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sep 3, 2022
Nov 5, 2021

README.md

现代Fortran程序设计的随书代码

代码风格

一般情况下,本书中的Fortran代码将遵守如下代码风格。

  • 对module中的变量与过程通过private/public对可见性进行限定。
module m
    implicit none
    private
    public :: a, x

    integer, parameter :: a = 1
    integer, dimension(:), allocatable :: x
    real :: b ! b is private

end module
  • use导入module时严格用only限定导入内容。
use m, only: a
  • dimension属性定义数组。
  • 定义变量时显式写出len/kind
  • 命名使用小写字母和下划线。
  • 缩进为四个空格。