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: Get rid of unused parameter warning? - comp.lang.c++I have an abstract base class which defines an interface to a function which takes 3 arguments. ... One way is not to name the parameters, give only type: int ... Enum type inside a class (matlab <-> java interface) - comp.soft ...Calling dll from Matlab - comp.soft-sys.matlab call java class from Matlab - comp.soft-sys.matlab Enum type inside a class (matlab <-> java interface) - comp ... Best design for my classes to avoid code duplication? - comp.lang ...I have an interface (abstract base class) to represent a "device": class IDevice { virtual ... I didn't specify the type of the m_protocol/layout members on purpose ... Solution to "cannot instantiate abstract class due to following ...... comp.lang.c++.moderated, Using MS Visual C++, I am trying to create two abstract classes ... My few experience is on dynamic typing languages. The errors I receive were ... What is "incomplete type?" (compiler error) - comp.lang.c++ ...I have a container C whose constructor takes a class B that is inherited from an abstract class A. ... The declaration makes C a "type" but, without the definition, such ... procedure() pointer - comp.lang.fortranLanguage Reference - Type-bound procedures... must be the name of an abstract interface or of a procedure that has ... polymorphic pointer? - comp.lang.fortran The classes do ... class definition containing member of own type - comp.lang.c++ ...... to note that at instantiation, the vector only needs to know about the interface of ... comp.lang.c++.moderated... 0X Iterating over the member variables of any class type ... Programming using JSP and Tomcat: cannot be resolved to a type ...... JasperException: Unable to compile class for ... Also, "Connection" is an interface, and has no ... clearer with an 'import' and simple class names. >>>> Also, naming a type ... naming convention for class attributes (member data)? - comp.lang ...CamelCase is also used for class names, and ICamelCase often for interfaces (or abstract base classes). ... struct { void* data; char* name; enum MATLAB_class type ... Swing uses bad features - comp.lang.java.guiIf the call site /is/ via an interface type, then vtables don't work, so other ... The Sun JVM does some funny things if you feed it debatably-valid class files ("interfaces ... Abstract Class versus Interface - CodeProjectAbstract class versus Interface: Usage and ... IMovable interface. An abstract class defines the core identity of a class and there it is used for objects of the same type. Should I use an abstract class or an interface? at C# Online.NET(COM was designed around interfaces.) Use an abstract class to define a common base class for a family of types. Use an abstract class to provide default behavior. 7/27/2012 11:28:09 PM
|