C/C++ and Fortran

 View Only

Declaring multiple type-bound procedures in a single procedure statement

By Archive User posted Thu August 01, 2013 01:55 AM

  

Originally posted by: Yvonne Ma


In Fortran 2003, users can declare only one type-bound procedure in each type-bound procedure statement. Fortran 2008 allows derived type definitions to contain multiple type-bound procedures in a single type-bound procedure statement. XL Fortran V14.1 supports this feature.

Here is an example. For more information about the feature, visit Syntax for a specific binding.

  type point_2003
    real x, y
  contains
    procedure :: h_distance
    procedure :: v_distance
  end type

  type point_2008
    real x, y
  contains
    procedure :: h_distance, v_distance
  end type

In the above example, the declaration of type point_2003 conforms to Fortran 2003 and above. It is accepted by Fortran 2003 compilers, such as XL Fortran 13.1, as well as Fortran 2008 compilers. The declaration of type point_2008, on the other hand, conforms to Fortran 2008, and is only accepted by XL Fortran 14.1 and above.

Authors: Rafik Zurob, Yvonne Ma

0 comments
0 views

Permalink