流程控制:输出标志存在,返回它;否则,在出错时停止
类型 | 意图 | 可选 | 属性 | 名称 | ||
---|---|---|---|---|---|---|
type(linalg_state_type), | intent(in) | :: | ierr | |||
type(linalg_state_type), | intent(out), | optional | :: | ierr_out |
pure subroutine linalg_error_handling(ierr,ierr_out) type(linalg_state_type),intent(in) :: ierr type(linalg_state_type),optional,intent(out) :: ierr_out character(len=:),allocatable :: err_msg if (present(ierr_out)) then ! Return error flag ierr_out = ierr elseif (ierr%error()) then err_msg = ierr%print() error stop err_msg end if end subroutine linalg_error_handling