Pointers to functions: Is this the right [f03] syntax?
- From: "Pere" <constans@xxxxxxxxxxxxx>
- Date: 20 Jun 2006 11:04:48 -0700
I am testing the f03 pointer to procedure functionality on the g95
compiler. This feature works smooth for subroutine procedures, but the
compiler seems 'confused' when pointees are functions. It issues the
error "Unexpected array reference".
I posted a message at the g95 forum about this issue. It is not clear
whether the test code --see bellow-- is not f03 standard compliant, or
it is not yet a fully implemented feature in g95.
So, the question is, is this the right syntax for pointer to functions?
module myMod
CONTAINS
real function proc3( arg1 )
integer :: arg1
proc3 = arg1+7
end function proc3
subroutine proc4( arg1 )
real, external :: arg1
print*, 'the func: ', arg1(0)
end subroutine proc4
end module myMod
program myProg
use myMod
PROCEDURE (proc3), POINTER :: p => NULL()
p => proc3
call proc4( p )
print*, 'the func: ', p(0) ! "Unexpected array reference"
end program myProg
.
- Follow-Ups:
- Re: Pointers to functions: Is this the right [f03] syntax?
- From: Richard E Maine
- Re: Pointers to functions: Is this the right [f03] syntax?
- Prev by Date: Re: GUI for fortran
- Next by Date: Re: Algorithm help for unique string searching/counting within an array.
- Previous by thread: help for reading a binary file
- Next by thread: Re: Pointers to functions: Is this the right [f03] syntax?
- Index(es):
Relevant Pages
|