Fortran intent(inout) v's no intent
Posted
by Andrew Walker
on Stack Overflow
See other posts from Stack Overflow
or by Andrew Walker
Published on 2010-05-21T08:26:39Z
Indexed on
2010/05/21
8:30 UTC
Read the original article
Hit count: 400
Good practice dictates that subroutine arguments in Fortran should each have a specified intent (i.e. intent(in)
, intent(out)
or intent(inout)
as described this question):
subroutine bar (a, b)
real, intent(in) :: a
real, intent(inout) :: b
b = b + a
...
However, not specifying an intent is valid Fortran:
subroutine bar (a, b)
real, intent(in) :: a
real :: b
b = b + a
...
Are there any real differences beyond compile time checking for an argument specified as intent(inout)
and an argument without a specified intent? Is there anything I should worry about if I'm retrofitting intents to older, intent free, code?
© Stack Overflow or respective owner