(j3.2006) Question about constant expressions with len type parameters

Bill Long longb
Tue Nov 11 09:23:39 EST 2014


For a type definition

  type foo (n)
     integer,len :: n
     real :: a(1:n)
  end type

you can certainly declare a variable

   type(foo(3))  :: x

but it is allowed to declare a named constant like this:

   type(foo(3)),parameter ::  c = foo(3)(a = [1.0,2.0,3.0])


The rules for constant expressions say you can rely on the value of a previously defined KIND type parameter, but the case for a LEN parameter seems less obvious.

Cheers,
Bill


Bill Long                                                                       longb at cray.com
Fortran Technical Suport  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101





More information about the J3 mailing list