- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why isthatthe Compaq Visual Fortran compiles this code:
integer function ifun()ifun=111
end program test call ifun() !i=ifun() endOK. Whilethe Intel Visual Fortran 10.0 displays the error:
Error: The CALL statement is invoking a function subprogram as a subroutine.
If I uncomment
i=ifun()
and comment call ifun() IVF, understandably,compiles it OK.
I was under the impression that Fortran allows functions to be call as subroutines
(the pgplot library that we usestopped compiling because of this).
An input from more experienced colleagues is much appreciated.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve for straightening it out.
Intel guysmay want to edit the following web page:
http://www.intel.com/support/performancetools/libraries/mkl/sb/cs-017175.htm
where it is explicitly stated that Fortran DOES allow to "call functions
as though the were subroutines...":
Because Fortran lets you call functions as though they were subroutines, however, there is a mechanism for returning the complex value correctly when the function is called from a C program. When a Fortran function is called as a subroutine, the return value shows up as the first parameter in the calling sequence - a feature that can be exploited by the C programmer.
This and the fact that all the other Fortran compilers I tried in the past allowed that
got me confused.
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page