Unrecognized finit-derived

Vikram Singh vikramsingh001@gmail.com
Sun Feb 5 18:07:00 GMT 2017


On Sun, Feb 5, 2017 at 7:46 PM, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
> 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

I meant more along the lines of something like -finit-real=inf to be
true inside derived types.  Its easier to catch errors that way.

Regards,
Vikram



More information about the Fortran mailing list