fortranderived-types

fortran derived type with parameterized len


I found this question/answer Fortran: Array of unknown size in type, which demonstrates fortran derived type with parameterized len.

type food(NBananaTypes,NAppleTypes)
 integer,len :: NBananaTypes,NAppleTypes
 INTEGER :: NBananasLeft(NBananaTypes)
 INTEGER :: NApplesLeft(NAppleTypes)
end type food

I would really like to use this feature of the standard. Which compilers will actually let you do this? gfortran does not.


Solution

  • The status of new standards implementation is regularly published in Fortran Forum. The latest version is http://dx.doi.org/10.1145/2460236.2460238 . You can see somwhat older version at http://fortranwiki.org/fortran/show/Fortran+2003+status which says you can use PGI, IBM or Cray compilers. From these three the only available for PC computers is the PGI. I also checked the recent version of the report and it does not add anything new.