- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am porting legacy code that have
structure aaa integer a1 real a2 C ... end structure structure /aaa/ bbb(100) common /ccc/ bbb
so an array bbb of structures aaa is placed into a common block ccc and wish this portable across Win/UX main fortran compilers.
I used
type aaa integer a1 real a2 C ... end type type (aaa) bbb(100) common /ccc/ bbb save /ccc/
however I cannot compile common and save statements on this code. Please, advice how to place said array of structures into common block and be sure that it is statically allocated and remain in memory?
Thank you!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
what errors are you seeing? This compiled for me on Windows.
By the way, the SAVE is redundant; COMMON is already SAVE by definition.
--Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A common block automatically has "save" status I do not think your SAVE is valid Fortran. If you are modernising why not share the data using a module rather than a common block.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The SAVE of a common block is perfectly standard, though as noted, unnecessary. In some earlier Fortran standards you might have needed it if there were no active procedures that declared that common.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page