- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The f2003 feature "associate"
associate (x => sin(x))
x = x / 5d0
endassociate
will run well. However, the following will not (when it points an expression rather than a variable)
associate (x => sin(x) + 1d0)
x = x / 5d0
endassociate
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Neither form supplied here appears to be valid, although I could be wrong.
According to Fortran 95/2003 (by Michael Metcalf, John Ker Reid, John Reid, Malcolm Cohen), on pg. 276 it states:
"If the association is with an expression, the associate-name may be used only for its value."
Both forms supplied here result in a compilation error when trying to assign to X:
sample.f90(6): error #6421: This scalar or array name is invalid in this context.
x = x / 5d0
----^
If you modify the use to assign to a variable other than X, each form is accepted and executes as expected.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page