- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to compile the following code from 'Modern Fortran Explained' (Metcalf et al), p291, with the derived type parameters commented out:
type character_with_max_length!(maxlen, kind)
!integer, len :: maxlen
!integer, kind :: kind = kind(’a’)
integer :: length = 0
character(20) :: value(100)
end type character_with_max_length
type(character_with_max_length) :: name=character_with_max_length('John Hancock')
I get the following compile error:
Omitted field is not initialized. Field initialization missing: [VALUE]
It appears that with the IVF compiler (2013) all components that are default initialized must come after the non-default initialized to make structure constructors work _without keywords_. {The following compiles: type(character_with_max_length) :: name=character_with_max_length(value='John Hancock') }
Should it be this way according to the standard (and, hence, Metcalf et al have an erroneous example), or is this a bug in the compiler?
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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