- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page