Software Archive
Read-only legacy content
17061 Discussions

what rationale?

rahzan
Novice
328 Views
One cannot use the fucntion SIZE with assumed size arrays which terribly annoying. The proper replacement for these are assumed shape arrays. That's just fine, but that an explicit interface is ALWAYS required even if the caller and callee are in the same project. If the two are in the same file, one gets a warning that says "explicit to assumed shape is a bad idea" .

What is the reationale for having the explicit interface, when the interface is right there in the subroutine?
Alt. what do we gain w. assumed shapes, if we're freed from passing the array size for redimensioning but then have the more elaborate requirment of a whole interface block?

Thanks in adv,
TimH
0 Kudos
2 Replies
Steven_L_Intel1
Employee
328 Views
The Fortran language is defined as an independent compilation model. There is no concept of "peeking" into another program unit in the same source file. If you used CONTAINed or MODULE procedures, you wouldn't have this problem, as the interfaces would be visible.

Steve
0 Kudos
Intel_C_Intel
Employee
328 Views
Explicit interfaces normally aren't achieved via INTERFACE blocks, but rather through USE association. Typically a subroutine that requires an explicit interface is placed inside a MODULE and that MODULE is USEd in the calling program unit.

Assumed shape arrays aren't always the best thing in terms of performance. You may want to simply pass the shape information along with the array as subroutine arguments as done in many math packages such as LAPACK.
0 Kudos
Reply