Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer var_name(N) to dimension(N) (or vice versa?) #43

Open
LiamPattinson opened this issue Sep 20, 2024 · 0 comments
Open

Prefer var_name(N) to dimension(N) (or vice versa?) #43

LiamPattinson opened this issue Sep 20, 2024 · 0 comments
Labels
enhancement New feature or request rule A new rule for the linter

Comments

@LiamPattinson
Copy link
Collaborator

real, dimension(N) :: array  ! version 1
real :: array(N)             ! version 2

! Similarly...

real, dimension(:) :: array  ! version 1
real :: array(:)             ! version 2

Fortran developers often code as if they're paid per keystroke, so I would assume version 1 to be the preferred method, but the Fortran-Lang page on learning arrays uses version 2 throughout. Either way, it should be kept consistent throughout a project, and a rule should exist to enforce this. I'd lean towards version 2 as it makes it much easier to stay within line-length limits, especially when you also start writing in kinds, intents, allocatable, pointer, target, contiguous, etc.

@LiamPattinson LiamPattinson added enhancement New feature or request rule A new rule for the linter labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rule A new rule for the linter
Projects
None yet
Development

No branches or pull requests

1 participant