When we write a standalone subroutine, with arguments say A, B, C, we can prevent the subroutine changing A and B by using the INTENT(IN) statement.
Now if the subroutine is contained in a module, A and B could be declared as module variables, then they become available to the subroutine (i.e. they are not required to be passed to the subroutine as arguments). If my understanding is correct, this produces faster running code as no copying of variables is required?
Question – is there a way of preventing the subroutine code (i.e. a programming error) inadvertently changing A or B, when declared as module variables?
Thanks
Ken