Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

"use only" for abstract interface

Hahaha
Beginner
312 Views

In my fortran program, I put all derived types, in one module. That module also includes the abstract interface, which is used for some procedure pointers in some derived types.

 

I was wondering, can I only use the abstract interface when use this module, instead of using everything in the module

 

For example

module A

type :: type1
real(8) :: val_1, val_2
procedure(sub1), nopass,pointer :: val_1_fun=>null(), val_2_fun=>null()
end type

Abstract interface
subroutine sub1(x,y)
real(8), intent(out) :: x
real(8), intent(in) :: y
end subroutine
end interface


program

use module A, only: sub1


end program

 

I tried the above one and it works. But I cannot find any other examples. So, is it the correct way to do so?

 

Thanks,

0 Kudos
1 Reply
IanH
Honored Contributor II
264 Views

Yes, that's the correct way to limit the entities made available by use association.

0 Kudos
Reply