This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FORTRAN 2003: Procedure Pointers doubts


Hi,
I have few doubts regarding "Procedure pointers",
introduced in F2k3 standard. 
I am explaining my doubts with a sample program below:

PROGRAM F2k3_PP
Interface
  Function ifun1(aa)
   integer::ifun1, aa
  end function
  Function ffun1(aa)
   real::ffun1, aa
  end function
  Function fun2(aa)
   real::fun2(10), aa
  end function
End interface

PROCEDURE(), POINTER::iptr1, fptr1
! iptr1 and fptr1 have an implicit interface and they
can be associated with a function / subroutine

PROCEDURE(REAL), POINTER::ptr2
! ptr2 can be associated with a function that returns
real data type.
! Please confirm if the following statements are
correct:

iptr1 => ffun1
! iptr1 has an implicit interface, so it can be
associated with a subroutine Or with a function that
returns scalar integer.
! As iptr1 is associated with a function that returns
real data type, so it is an incorrect statement,
Please confirm

fptr1 => ifun1
! fptr1 has an implicit interface, so it can be
associated with a subroutine Or with a function that
returns scalar real.  
! As fptr1 is associated with a function that returns
integer data type, so it is an incorrect statement,
Please confirm.

ptr2 => fun2    ! fun2 reaturn an array of rank one
with real data type.
! ptr2 can be associated to a function, that returns
real data type. 
! Question is, whether it should be associated with a
function that returns scalar real Or real data type
with any shape. Please confirm.

end F2k3_PP

I have gone through the DIS for Fortran 2003, but that
does not clear my doubts. 
For first two cases, I have written my own
interpretation of the standard.
For the third case, I was undecided, but it seems that
ptr2 can be associated with a function that returns
scalar real.

It will be very nice of you, if somebody can rescue me
from my doubts !


Thanks and best regards,
F2k3


	
		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]