Print

Print


All the compilers I tried choke on this one, so I guess
I am doing something wrong...

If I have
use def
in the following piece of code, it works.
But if I want to use only some entities of the module, how do I
specify my operator?

Thanks

Bertrand

----------------------------------------
module def

    integer :: ia, ib, ic

    interface operator ( .EQMODTEN. )
       module procedure EQ_MOD_10
    end interface

contains

    logical function EQ_MOD_10( n1, n2)

    implicit none
    integer, intent( in) :: n1, n2
    integer :: m1, m2

    m1 = MOD( n1, 10)
    m2 = MOD( n2, 10)

    EQ_MOD_10 = .false.
    if ( m1 == m2 ) EQ_MOD_10 = .true.

    end function EQ_MOD_10

end module def

program test

! use def  ! OK
use def, only : ib, .EQMODTEN.  ! wrong

implicit none
integer :: na, nb

na = 17
nb = 43

if ( na .EQMODTEN. nb ) then
    print *, ' yes '
else
    print *, ' no '
endif

end program test

-------------------------------------

-- 

Bertrand Meltz
Commissariat a lŽEnergie Atomique   |  e-mail : [log in to unmask]
CEA / DIF  , BP 12                  |  Tel : (33) [0] 1 69 26 57 83
91680 Bruyeres-le-Chatel , FRANCE   |  Fax : (33) [0] 1 69 26 70 93