Unrecognized finit-derived

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Feb 5 17:46:00 GMT 2017


On Sun, Feb 05, 2017 at 07:11:54PM +0200, Vikram Singh wrote:
> 
> I have gcc 6.3.0. The docs in the installed directory don't seem to
> have this option. Do I have an alternative for initializing integers
> inside derived types?
> 

Are you serious?  Of course, you have an option for 
initializing integers inside a derived type.  Here's
three example

program foo

  type a
    integer :: i = 1   ! Default initialization
  end type a

  type b 
    integer :: i
  end type b

  type(a) c            ! c%i is default initialized to 1
  type(b) :: d = b(1)  ! d%i is initialized to 1
  type(b) :: e
  !
  ! Initialization section of code.
  !
  e%i = 1
  !
  ! Sections of code that do something with initialized entities
  !
  print *, c, d, e
end program foo
  
Now, if you mean "does the compiler have an option that allows a
programmer to be lazy?", then you'll need to use trunk.

-- 
Steve
20161221 https://www.youtube.com/watch?v=IbCHE-hONow



More information about the Fortran mailing list