- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all -
Using XP(SP3), VS2010 +IVF 12.0.1.127 [IA-32]...
I think it should be possible to compile this test program, butone form of array intialization works while the other one doesn't work. This is a demo example. In my real program the derived data structure MD_STR has integer arrays, character-string arrays and real scalars;and the variable ZNKONST is itself an array of the MD_STR derived type.
The same issue is present in 12.0.0.x (whatever came with the original DVD)
This problem does not occur under VS2010 + IVF 11.0.061
===================
Is my initialization somehow flawed? Any suggestions would be welcome.
Using XP(SP3), VS2010 +IVF 12.0.1.127 [IA-32]...
I think it should be possible to compile this test program, butone form of array intialization works while the other one doesn't work. This is a demo example. In my real program the derived data structure MD_STR has integer arrays, character-string arrays and real scalars;and the variable ZNKONST is itself an array of the MD_STR derived type.
The same issue is present in 12.0.0.x (whatever came with the original DVD)
This problem does not occur under VS2010 + IVF 11.0.061
===================
program Console1
implicit none
TYPE MD_STR
INTEGER :: SPP(4)
INTEGER :: OBSERV
END TYPE
TYPE (MD_STR) ZNKONST
DATA ZNKONST /
> MD_STR (
> (/1, 0,0,0 /), ! This is OK
! > (/1, 3*0 /), ! This is bad
> 200
> ) /
print *, 'Hello World'
end program Console1
Is my initialization somehow flawed? Any suggestions would be welcome.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The 3*0 syntax is not valid in an array constructor. What you actually did with that is have an array constructor with only two elements, the second of which was 0. You want this instead:
DATA ZNKONST / MD_STR ((/1, (0,I=1,3) /), 200 ) /
DATA ZNKONST / MD_STR ((/1, (0,I=1,3) /), 200 ) /
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The 3*0 syntax is not valid in an array constructor. What you actually did with that is have an array constructor with only two elements, the second of which was 0. You want this instead:
DATA ZNKONST / MD_STR ((/1, (0,I=1,3) /), 200 ) /
DATA ZNKONST / MD_STR ((/1, (0,I=1,3) /), 200 ) /
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bang on, Steve -
I changed the syntax as you suggested (both integers and character strings) and the compiler is happy. Just a few dozen more edits to go.
Interesting that this is trapped in XE2011 but not IVF 11. A case of 'per ardua ad astra' no doubt.
Thanks again for your help.
I changed the syntax as you suggested (both integers and character strings) and the compiler is happy. Just a few dozen more edits to go.
Interesting that this is trapped in XE2011 but not IVF 11. A case of 'per ardua ad astra' no doubt.
Thanks again for your help.

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