Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

calling function

buchos
Beginner
456 Views
haw to call a function without an assigning a returning value?

following code works at Compaq:

program TestProgram

call testFunction()

contains

integer function testFunction()
testFunction = 13
end function testFunction

end program TestProgram

but Intel compiller returns the error:
Test.F90(4): Error: The CALL statement is invoking a function subprogram as a subroutine. [TESTFUNCTION]
0 Kudos
1 Reply
Steven_L_Intel1
Employee
456 Views
You fix the error in your code and reference it as a function. The cases where it was "safe" to CALL a function were too few so we simply disallowed this. Assign the value to a throwaway variable.
0 Kudos
Reply