Question about DATA statement initialisation in a module
From: Paul Van Delst (paul.vandelst_at_noaa.gov)
Date: 07/30/04
- Next message: bv: "Re: passing functions or subroutines in a subroutine"
- Previous message: jan van oosterwijk: "Re: Allocatable vs pointer in procedure resolution"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 29 Jul 2004 18:38:19 -0400
Hello,
A colleague had some code like:
MODULE mydata
PRIVATE
REAL, PUBLIC, SAVE, DIMENSION(10)::emc
DATA emc/1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0/
END MODULE mydata
which compiled with no problems. When he USEd the module mydata in some other code and
printed out the values of "emc" he always got zeroes. I never use DATA statements anymore,
so I changed the code to
MODULE mydata
PRIVATE
REAL, PUBLIC, PARAMETER, DIMENSION(10)::emc = &
(/1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0/)
END MODULE mydata
and, as expected, when he printed out the "emc" numbers they were now 1.0,2.0,...10.0.
My question is, why doesn't the first module make the emc numbers available? Oh, and both
forms worked using the PGI compiler. Only the SGI f90 compiler gave zeroes for the first form.
Thanks,
paulv
- Next message: bv: "Re: passing functions or subroutines in a subroutine"
- Previous message: jan van oosterwijk: "Re: Allocatable vs pointer in procedure resolution"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]