- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
When I try to compile the code below, I get an error stating that the specified interface (for the procedure func) is not declared. But if I place the "square" function right before "loopOverFunc" then I get no error (although I get a misleading warning regarding the result of the "square" function). Is it a bug in the compiler or the intended behavior?
module mod1
implicit none
contains
!------------------------------------------------------------------------------
function loopOverFunc(func, array) result(sq)
procedure(square) :: func
integer, intent(IN) :: array(:)
integer :: sq(SIZE(array))
integer :: i
continue
do i = 1, SIZE(array)
sq(i) = func(array(i))
enddo
end function
!------------------------------------------------------------------------------
elemental function square(a) result(sq)
integer :: sq
integer, intent(IN) :: a
continue
sq = a ** 2
end function
end module mod1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page