- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A question for a customer for which I don't have a good answer. This is one for Doctor Fortran
The question posed: "Why is it that contained functions in pure routines need to be pure? If they capture state from the parent, and only use that state, the expectations of the caller can still be met. It seems to me there should be several weaker forms of pure, for example, just that the contained function references no global variables through USE statements."
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The basic restriction is that a PURE procedure can call only other PURE procedures. There's really no distinction between a contained procedure and an external one here. This requirement helps enforce the PURE requirements of the outer procedure.
I suppose I'd have to ask what it is that needs to be done in a non-PURE internal procedure that is called from a PURE procedure?
I'll also comment that Fortran 2008 offers IMPURE ELEMENTAL if that's what you want, and that's now supported by Intel Fortran. (ELEMENTAL procedures are PURE otherwise.)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page