Assignments in Modules
From: Ed Wells (wellsed_at_wam.umd.edu)
Date: 10/23/03
- Next message: Paul van Delst: "Re: Assignments in Modules"
- Previous message: Ravi: "ELF90 - "Unrecognized option in Command file""
- Next in thread: Paul van Delst: "Re: Assignments in Modules"
- Reply: Paul van Delst: "Re: Assignments in Modules"
- Reply: Richard Maine: "Re: Assignments in Modules"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 23 Oct 2003 10:43:39 -0700
After some simple testing I've decided I may not really understand how
to use modules in modern Fortran. In the simple code that follows I
attempt to do two things:
1) In an declaration, give a module variable an initial value and then
use that value in the bounds for a module declared array, and
2) after the declaration statements, assign values to my module array
variables using simple assignments of array constructors.
The problem is, these things do not work, though they seem "obvious"
as things I would want in my modules (global data with defined values
and arrays automatically bounded by globally defined variables). So,
besides the use of "obvious", why do these things not work and how can
I get around this problem? I've tested the following code using Intel
ifc 7.1 on RedHat Linux 8.0 (with libc problems fixed) and on a Sun
machine with Sun WorkShop 6 update 1 Fortran 95 6.1.
Thank you,
Ed Wells
Code follows:
module test
implicit none
public
integer :: NA=3
integer :: x(1:3,1:NA)
x(:,1) = (/ 1, 2, 3 /)
x(:,2) = (/ 4, 5, 6 /)
x(:,3) = (/ 7, 8, 9 /)
end module test
!
program tester
use test
implicit none
integer :: i
! call setup(x)
do i=1,3
write(*,*) x(:,i)
end do
end program tester
- Next message: Paul van Delst: "Re: Assignments in Modules"
- Previous message: Ravi: "ELF90 - "Unrecognized option in Command file""
- Next in thread: Paul van Delst: "Re: Assignments in Modules"
- Reply: Paul van Delst: "Re: Assignments in Modules"
- Reply: Richard Maine: "Re: Assignments in Modules"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|