This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
FORTRAN 2003: Procedure Pointers doubts
- From: F2k3 <papasanna at yahoo dot com>
- To: fortran at gcc dot gnu dot org
- Date: Wed, 8 Dec 2004 01:32:44 -0800 (PST)
- Subject: FORTRAN 2003: Procedure Pointers doubts
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=cA6RegWKm4yPW/60xfsISoJ64TaeCcZZ0o66De9neiYJ32VCOXNKXwUvBX0CW7J9ju9f8URP4P312q6dKbHihODPABZZsZIt8ordd+Bc3QlzFL0tIMlytBPJchGCzt2mI2+g2WKAJ9zqkCFPEOlan1eqFclDlgG+Vycc/hrTMSY= ;
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