- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use CVF 6.6.A Professional.
I have seen in some documentation that one cannot use allocatable arrays in the definition of derived types. And yet the code below seems to work. The only problem with it is the last print output which gives some funny extra output. Do you think it wold be safe to proceed assuming this works?
*******************************************************
! PROGRAM: TestBed
! PURPOSE: Test ALLOCATABLE component of derived type
!*******************************************************
program TestBed
implicit none
integer(4) i,j
TYPE tagStar
integer(4) Mass
integer(4) Other
END TYPE
TYPE tagCluster
integer(4) numStars
type (tagStar), ALLOCATABLE :: Stars(:)
END TYPE tagCluster
TYPE (tagCluster), ALLOCATABLE :: Clusters(:)
ALLOCATE (Clusters(3))
print *, ALLOCATED (Clusters(1)%Stars) ! prints false
do i=1,3
ALLOCATE (Clusters(i)%Stars(i+2))
end do
print *, ALLOCATED (Clusters(1)%Stars) ! prints true
do i = 1,3
Clusters(i)%Stars(i+2)%Mass = i+90
end do
do i = 1,3
print *, Clusters(i)%Stars(i+2) ! prints 91,92,93 and
! some other funny stuff?
end do
End Program TestBed
LongThong
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately, I am stuck with 6.6A. Is there any way, now that Compaq is out of the picture, to upgrade to C?
LongThong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It would be much better if you purchased Intel Visual Fortran 10 instead - many bugs relating to this feature have been fixed since CVF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve,
The link works. I will download it when I have time. (Dial-up!)
Thanx much for all the help.
LongThong
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page