- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
IVF seems to handle successive data statements differently from CVF. The program here below illustrates that:
program Test
implicit none
integer :: i
real(8) :: array(3)
data array/3*-999/
data array(1)/11/
write(*,*) (array(i),i=1,3)
end program Test
The results are:
in CVF 11 -999 -999
in IVF -999 -999 -999
I assume successive data statements for the same array are just a bad idea, but is there a way to obtain the CVF result with IVF?
Thanks,
Michal
IVF seems to handle successive data statements differently from CVF. The program here below illustrates that:
program Test
implicit none
integer :: i
real(8) :: array(3)
data array/3*-999/
data array(1)/11/
write(*,*) (array(i),i=1,3)
end program Test
The results are:
in CVF 11 -999 -999
in IVF -999 -999 -999
I assume successive data statements for the same array are just a bad idea, but is there a way to obtain the CVF result with IVF?
Thanks,
Michal
Message Edited by mkummert on 05-05-2004 03:40 PM
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The program is illegal. You're not allowed to initialize the same element more than once. If it "worked" in CVF it was by coincidence, not design.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the section describing the DATA statement my DVF and IVF language reference manuals both state that a variable can be initialized only once in an executable program. What you're observing with CVF is probably nonstandard behavior and could be a bug. I wouldn't trust any workaround to duplicate that behavior in IVF--if it even exists. It could change at any time in the future.
The better option is to change your code. One possibility is to change data array/3*-999/ to data array/11, 2*-999/, although I recommend using data array/11.d0, 2*-999.d0/ since array is the real(8) type.
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you both for your answers.
DATA statements like :
DATA array/11.d0,2*999.d0, etc.
would be hard to read in the real program (big arrays with only a few spots reassigned) so I just used an initialization routine that is easy to read.
I will report the programmer to the competent authorities ;-)
Michal
DATA statements like :
DATA array/11.d0,2*999.d0, etc.
would be hard to read in the real program (big arrays with only a few spots reassigned) so I just used an initialization routine that is easy to read.
sblionel wrote:The program is illegal. ...
I will report the programmer to the competent authorities ;-)
Michal

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page