- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a Fortran 90 code which looks like the following:
=============================
Real :: e
Real :: a,b,c,d
Real :: a1,b1,c1,d1,p,q
a(a1,b1,c1,q) = a1+b1*c1-d1/8.
Integer :: i1
! Main computation starts
e = a(2.,5.,6.,9.)
==============================
Would you guys please explain what does the "a(a1,b1,c1,q) = a1+b1*c1-d1/8." line segment means? Is it similar to a function call? What do we call this capability in fortran or programming languages in general?
Thanks!
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is an obsolescent language feature called "statement function". It is a one-line declaration of a function named "a" that takes four arguments and returns as a result the expression on the right side of the equal sign. The datatype of "a" and its arguments are taken from the earlier declarations. The scope of the declaration of "a" is that routine only.
The last line calls "a" and passes it four arguments - the result is stored in "e".
Statement functions are still technically part of the Fortran language, but are termed "obsolescent" and will be flagged as such by compilers when standards checking is enabled. The recommend replacement is internal functions.
The last line calls "a" and passes it four arguments - the result is stored in "e".
Statement functions are still technically part of the Fortran language, but are termed "obsolescent" and will be flagged as such by compilers when standards checking is enabled. The recommend replacement is internal functions.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is an obsolescent language feature called "statement function". It is a one-line declaration of a function named "a" that takes four arguments and returns as a result the expression on the right side of the equal sign. The datatype of "a" and its arguments are taken from the earlier declarations. The scope of the declaration of "a" is that routine only.
The last line calls "a" and passes it four arguments - the result is stored in "e".
Statement functions are still technically part of the Fortran language, but are termed "obsolescent" and will be flagged as such by compilers when standards checking is enabled. The recommend replacement is internal functions.
The last line calls "a" and passes it four arguments - the result is stored in "e".
Statement functions are still technically part of the Fortran language, but are termed "obsolescent" and will be flagged as such by compilers when standards checking is enabled. The recommend replacement is internal functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
Wouldn't this "obsolescent" "statement function" come back in Vogue as Lambda functions?
Lambda function in the sense of C++0x.
Jim
Wouldn't this "obsolescent" "statement function" come back in Vogue as Lambda functions?
Lambda function in the sense of C++0x.
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not really, because lambda functions are unnamed and are basically declared where they're used. But I suppose it's the closest that C++ has to the idea. Statement functions have awkward limitations and puzzling scope - internal procedures are much better, which is why statement functions were selected for deprecation.

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