Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Passing an allocated array

$
0
0

I have an array that is defined to be ALLOCATABLE (defined in my main program).  A subroutine is call and that is where it will be allocated.  So the dummy argument of the subroutine also needs to be ALLOCATABLE.  For this work correctly, the subroutine needs an explicit interface and I have that in a module.

After that, the array will need to be passed into other subroutines.  These subroutines will never be messing around with allocation -- simply using the contents of the array.

Currently, I have the dummy argument for the array in other subroutines sizing the array explicitly.  The scalar that sizes the dummy array argument is the same value that allocated the array.

The question is...is this "safe" to do?  My program compiles and executes successfully, but I'd like to have some opinions and thoughts on the matter.

Thanks!


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>