class or type in an abstract interface

  • Follow


Hello,

a quick question about default initialisation of procedure pointer
components. Code like this:

     type fish_type
         ...
         procedure(behaving), pointer :: behave => behave_juvenile
     end type fish_type

(that is, with the procedure pointer "behave" pointing to some routine)
is accepted by gfortran (4.6.1), but not by Intel Fortran (12.0.3)

Is such an initialisation an extension or not (or is this part of
F2008)?

Using -std=f2003 does make gfortran complain about the
initialisation and -std=f2008 makes it go away again, so I guess that
answers my question.

Regards,

Arjen
0
Reply arjen.markus895 (633) 9/27/2011 11:31:00 AM

Oops, that title is misleading. My question is about initialising
a procedure pointer.

Regards,

Arjen
0
Reply arjen.markus895 (633) 9/27/2011 11:32:14 AM


On 27-9-2011 13:31, arjenmarkus wrote:
> Hello,
>
> a quick question about default initialisation of procedure pointer
> components. Code like this:
>
> type fish_type
> ...
> procedure(behaving), pointer :: behave => behave_juvenile
> end type fish_type
>
> (that is, with the procedure pointer "behave" pointing to some routine)
> is accepted by gfortran (4.6.1), but not by Intel Fortran (12.0.3)
>
> Is such an initialisation an extension or not (or is this part of
> F2008)?
>
> Using -std=f2003 does make gfortran complain about the
> initialisation and -std=f2008 makes it go away again, so I guess that
> answers my question.

A quick look at the standard documents seems to indicate that the 
relevant part is R1214, which is found in f2008 in section 12.4.3.6, and 
in f2003 in section 12.3.2.3, both titled Procedure declaration statement.

In f2008 it reads:
R1214 proc-decl is procedure-entity-name [ => proc-pointer-init ],

whereas in f2003 it reads:
R1214 proc-decl is procedure-entity-name[ => null-init ].

Erik.
0
Reply user195 (73) 9/27/2011 11:59:58 AM

Hi Arjen,

> Is such an initialisation an extension or not (or is this part of
> F2008)?
>
> Using -std=f2003 does make gfortran complain about the
> initialisation and -std=f2008 makes it go away again, so I guess that
> answers my question.

Right. This is an F08 feature, which is supported by gfortran starting
from version 4.6, while ifort apparently does not support it yet
(hopefully soon).

Btw, F08 also allows the initialization of data pointers in the same
fashion (which is also supported by gfortran already).

Cheers,
Janus
0
Reply janus (26) 9/27/2011 12:32:56 PM

3 Replies
80 Views

(page loaded in 0.093 seconds)

Similiar Articles:













7/27/2012 11:28:09 PM


Reply: