userop.f90

来自「用于进行gcc测试」· F90 代码 · 共 68 行

F90
68
字号
module uops   implicit none   interface operator (.foo.)      module procedure myfoo   end interface   interface operator (*)      module procedure boolmul   end interface   interface assignment (=)      module procedure int2bool   end interfacecontainsfunction myfoo (lhs, rhs)   implicit none   integer myfoo   integer, intent(in) :: lhs, rhs   myfoo = lhs + rhsend function! This is deliberately different from integer multiplicationfunction boolmul (lhs, rhs)   implicit none   logical boolmul   logical, intent(IN) :: lhs, rhs   boolmul = lhs .and. .not. rhsend functionsubroutine int2bool (lhs, rhs)   implicit none   logical, intent(out) :: lhs   integer, intent(in) :: rhs   lhs = rhs .ne. 0end subroutineend moduleprogram me   use uops   implicit none   integer i, j   logical b, c   b = .true.   c = .true.   if (b * c) call abort   c = .false.   if (.not. (b * c)) call abort   if (c * b) call abort   b = .false.   if (b * c) call abort   i = 0   b = i   if (b) call abort   i = 2   b = i   if (.not. b) call abort   j = 3   if ((i .foo. j) .ne. 5) call abortend program

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?