(j3.2006) LEN type parameter

Bill Long longb
Mon Dec 18 18:37:51 EST 2017


> On Dec 18, 2017, at 5:28 PM, Van Snyder <Van.Snyder at jpl.nasa.gov> wrote:
> 
> On Mon, 2017-12-18 at 23:23 +0000, Bill Long wrote:
>> Interesting test with very inconsistent compiler behavior:
>> 
>>     program t03
>>     type badtype (p5)
>>       integer, len         :: p5
>>       real (kind=p5)       :: x    ! X decl line
>>       integer              :: y=p5 ! Y decl line
>>     end type badtype
>>     end
>> 
>> Compiler 1: Error for both X and Y lines
>> Compiler 2: No errors
>> Compiler 3: Error for Y line only
>> Compiler 4: (Evidently does not support pdt yet. Every line that includes ?p5? got an error.)
>> 
>> It reduces to whether a LEN type parameter is a constant expression.
>> Does not seem to be reasonable to me that it would be.
> 
> We should clarify what we want.  Maybe the type definition is OK, but
> you can't declare any objects of the type with a specification
> expression for the value of the type parameter.
> 

Or specifying the value as deferred in the object declaration.  But if you have those limitations, why not just declare p5 to be a KIND type parameter up front? You would not be taking any advantage of the special capabilities of a LEN parameter. 

Cheers,
Bill




>> Cheers,
>> Bill
>> 
>> Bill Long                                                                       longb at cray.com
>> Principal Engineer, Fortran Technical Support &   voice:  651-605-9024
>> Bioinformatics Software Development                      fax:  651-605-9143
>> Cray Inc./ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425
>> 
>> 
>> _______________________________________________
>> J3 mailing list
>> J3 at mailman.j3-fortran.org
>> http://mailman.j3-fortran.org/mailman/listinfo/j3
> 
> 
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

Bill Long                                                                       longb at cray.com
Principal Engineer, Fortran Technical Support &   voice:  651-605-9024
Bioinformatics Software Development                      fax:  651-605-9143
Cray Inc./ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425





More information about the J3 mailing list