4 ms·
The conventional, idiomatic style is to mark the `intent` of your function/subroutine arguments. Then the compiler can check that you don't attempt to mutate in
by sampo 5y ago
The conventional, idiomatic style is to mark the `intent` of your function/subroutine arguments. Then the compiler can check that you don't attempt to mutate input variables, or read the output variables.
pure subroutine mean_and_std(vec, mean, std)
real, intent(in) :: vec(:)
real, intent(out) :: mean, std
mean = sum(vec) / size(vec)
std = sqrt(sum((vec - mean)**2) / size(vec))
end subroutine
- anonymousiam 5y agoThanks! Apparently the "intent" attribute was added in FORTRAN 2003. This was about 20 years too late for the A900. http://www.hpmuseum.net/display_item.php?hw=594 http://www.hpmuseum.net/display_item.php?hw=594
- sampo 5y ago> Apparently the "intent" attribute was added in FORTRAN 2003. It was added in Fortran 90.
- anonymousiam 5y agoEither way, it was too late for me. The A900 FORTRAN compiler did "Extended FORTRAN 77" and the "card" at the top of each source file was: FTN7X